Display ñ on a C# .NET application
Posted
by mmr
on Stack Overflow
See other posts from Stack Overflow
or by mmr
Published on 2009-01-10T02:16:11Z
Indexed on
2010/05/31
22:33 UTC
Read the original article
Hit count: 460
I have a localization issue.
One of my industrious coworkers has replaced all the strings throughout our application with constants that are contained in a dictionary. That dictionary gets various strings placed in it once the user selects a language (English by default, but target languages are German, Spanish, French, Portuguese, Mandarin, and Thai).
For our test of this functionality, we wanted to change a button to include text which has a ñ character, which appears both in Spanish and in the Arial Unicode MS font (which we're using throughout the application).
Problem is, the ñ is appearing as a square block, as if the program did not know how to display it. When I debug into that particular string being read from disk, the debugger reports that character as a square block as well.
So where is the failure? I think it could be in a few places:
1) Notepad may not be unicode aware, so the ñ displayed there is not the same as what vs2008 expects, and so the program interprets the character as a square (EDIT: notepad shows the same characters as vs; ie, they both show the ñ. In the same place.).
2) vs2008 can't handle ñ. I find that very, very hard to believe.
3) The text is read in properly, but the default font for vs2008 can't display it, which is why the debugger shows a square.
4) The text is not read in properly, and I should use something other than a regular StreamReader to get strings.
5) The text is read in properly, but the default String class in C# doesn't handle ñ well. I find that very, very hard to believe.
6) The version of Arial Unicode MS I have doesn't have ñ, despite it being listed as one of the 50k characters by http://www.fileinfo.info.
Anything else I could have left out?
Thanks for any help!
© Stack Overflow or respective owner