String Comparison Fails And String Contains A Dash

Our Integration Partner, using a Web Service of ours via their Workflow application, was complaining that our WCF Service was broken in the UAT environment.

The error logs showed this:
2011-01-13 16:23:07,645 [5] ERROR Error in PerformPolicyLookup PolicyNumber: 9999999 Error: Unknown client name “SmithsCrisps – NZ”

But when I accessed the same Web Service through a Visual Studio Project running on my Desktop the Web Service call ran fine.
The URL for that Web Service had changed just a fortnight back so I suggested that maybe they were not accessing the correct Web Service and that they needed to check what URL they were using or maybe regenerate their proxy classes.

Well their Developer got back to me and said that in the Database the dash in “SmithsCrisps – NZ” was stored as an Elongated Dash, properly known as the em Dash, Unicode 2014, whereas the Web Service tested for Client Name based on the en dash, Unicode 2013.

…which doesn’t really add up since the actual Client Name parameter must have been passed as an Elongated Dash (em dash) if it ended up actually matching records on the database, but yet it supposedly also matched against en dash in the parameter validation part of the Web Service call.

So he reckons he updated the Database to use en dashes (the short ones).

…sounds a bit fishy.

But anyway, for our purposes, if you find a String Comparison is failing and the String in question has a Dash in it then be aware that there are several different kinds of dashes.Everthing you ever wanted to know about Dashes is here courtesy of the ubiquitous Wkipedia.

Naturally, dashes can be things that matter most

And one more thing: make sure there are no hyphens in the mix as well or else you may find yourself requiring medical assistance.

Advertisements

Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: