3

Possible Duplicate:
.net micro (µ) greek letter uppercase issue

I have a function that is converting all string to uppercase. I'm just using string.ToUpper() method.

Well it's working. But for some characters ToUpper() is doing weird stuff. Like for µ, a µ.ToUpper() is an M. Why? How can I avoid this? Just UpperCase chars if there is an upper case character :)?

Community
  • 1
  • 1
sabisabi
  • 1,501
  • 5
  • 22
  • 40

3 Answers3

5

Specify culture or use InvariantCulture when doing string transformations. For example:

"µ".ToUpper(CultureInfo.InvariantCulture)

or

"µ".ToUpperInvariant()

returns µ

Ilya Ivanov
  • 23,148
  • 4
  • 64
  • 90
5

You can use the method String.ToUpperInvariant().

In this method, the invariant culture is used.

This method is exactly the same as calling myString.ToUpper(CultureInfo.InvariantCulture);

Cédric Bignon
  • 12,892
  • 3
  • 39
  • 51
0

It's most probabbly culture related issue, use a String.ToUpper Method (CultureInfo), where you can specify Invariant culture.

Tigran
  • 61,654
  • 8
  • 86
  • 123