问题
I faced a strange problem while coding a Turkish site... In my vb.net code I use a vb function StrConv(s, VbStrConv.ProperCase)
where s
is the string that needs to be propercased. For the Turkish site, the "ı" character is not properly propercased. Do you have any ideas how to solve this? Thanks.
回答1:
This (infamous) case is known as the Turkish I Problem. Jeff Atwood has written about it: What's wrong with Turkey? If you uppercase a Turkish lowercase dotless i, it becomes the uppercase English I. Then, if you lowercase that, it becomes an English lowercase dotted i. (That is, the operation is not commutative.) See this link for the solution.
回答2:
As I recall the Turkish "ı" is one of the two cases where converting to upper case and then back to lower case again will not yield the original string. The other one is the German sharp "s" (i.e. ß).
What exactly is the result of the StrConv call?
Are you a native Turkish speaker and do you expect a specific result? If Yes: There might be a bug in the .NET CLR. Then please post the exact .NET version you are using.
Otherwise the result might be perfectly fine even though it looks strange for a non-Turkish user.
I'm German so for the German sharp s: There is no upper case ß. Lower case is "ß". Convert to upper case: "SS". And back to lower case: "ss"
回答3:
FileReader = New StreamReader(OpenFileDialog1.FileName, Encoding.Default)
Encoding.Default
solves this problem in vb.net
来源:https://stackoverflow.com/questions/17167460/turkish-character-in-asp-net