0

I think I have an encoding problem that needs to be fixed. Is there a way to compare strings across code pages?

Oracle returns a string "TEST - My String" with the minus sign encoded as ascii 63. SQL Server quite correctly returns the string with the minus encoded as 45.

Is there a way to compare these strings? Does the framework contain a comparison that is capable of ignoring code page mismatches.

1 Answer 1

1

Use one of the overloads of string.compare, probably:

if (string.Equals(value1, value2, StringComparison.OrdinalIgnoreCase))
{
   ...
}

More useful info here:

http://msdn.microsoft.com/en-us/library/dd465121.aspx

Sign up to request clarification or add additional context in comments.

1 Comment

Hi, I have accepted your answer. It's not strictly speaking correct, but there isn't a better one I don't think. Strings have to be compared within the code page they originate from. I have elected to solve the problem by using a fuzzy search. Alternatively one could convert the strings to the same code page but that's too much P.T.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.