From: Peter Duniho on
On Wed, 23 Sep 2009 21:27:46 -0700, Sreenivas
<thatiparthysreenivas(a)gmail.com> wrote:

> Pete , i have a question. Does RegexOptions.IgnoreCase( in the code
> snippet i posted ) guarantee the comparison of all Unicode characters?
> What i am asking is , is my code snippet works for all unicode
> characters?

It had better. The Regex class is defined to operate on .NET strings,
which are Unicode. If you find it doesn't, you should report that as a
bug.
From: Morten Wennevik [C# MVP] on
Yes, there is documentation that say this is a problem, and I agree for many
it really is a problem, but it is more a problem of ignorance and rather than
the code language, or how unicode works. If you rely on learning "safe ways"
to deal with multiple cultures you will be none the wiser if you stumble upon
a new scenario. Instead be aware that cultures are different. Language
rules differ. Sorting rules differ. Number styles differ. Comma is not
always a thousand separator. Dot is not always a decimal separator, etc. If
you try to sort "bbb" "aaa" "ccc" alphabetically you won't even get the same
sort order. If you expect cross culture input you need to be aware of this
and not do cross culture comparison, there are simply so many rules that
differ that you will have to stick to a single culture.

--
Happy Coding!
Morten Wennevik [C# MVP]


"Peter Duniho" wrote:

> On Wed, 23 Sep 2009 00:52:01 -0700, Morten Wennevik [C# MVP]
> <MortenWennevik(a)hotmail.com> wrote:
>
> > I disagree.
>
> You can disagree all you like. It doesn't undo the documented problem.
>
> It is true that if you can limit the input to ASCII, or some particular
> culture, it is possible to get away with using case-conversion. But .NET
> operates on Unicode strings, and provides no concise way to represent
> those limitations. Furthermore, when you are posting to a public
> newsgroup, you have no way to guarantee that code that uses
> case-conversion will be used in this limited way even by convention.
>
> It is nearly as easy to do the comparison _correctly_ as it is to do it
> incorrectly. It makes no sense to prefer to write the code to do it
> incorrectly.
>
> Pete
>