|
|
Home » U++ Library support » U++ Core » [SOLVED] String.GetCount with umlaut
[SOLVED] String.GetCount with umlaut [message #33707] |
Tue, 06 September 2011 23:12 |
|
forlano
Messages: 1189 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Hello,
GetCount() returns 7 for the string "lubäck"
I see only 6 characters. Where is the trick?
I guess 'ä' is counted twice, but how can I know how many characters are really there in a string?
I am having problem with string aligning of text file in case of accented characters. If even GetCount give uncorrect answer I will not be able to correct the row lenght to be displayed adding additional space (it seems that for each accented characters a space is eated). By the way this was an old issue that I was never able to resolve in my application.
//SetDefaultCharset(CHARSET_UTF8);
String ss, t = "lubäck";
ss << t.GetCount();
SaveFile("out.txt", ss);
Thanks,
Luigi
[Updated on: Thu, 15 September 2011 09:33] Report message to a moderator
|
|
|
|
Re: String.GetCount with umlaut [message #33710 is a reply to message #33709] |
Wed, 07 September 2011 08:27 |
|
forlano
Messages: 1189 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
forlano wrote on Wed, 07 September 2011 08:20 |
Perhaps I must convert the name to some other encoding before to save them let go to try ...
|
Solved!
out << NFormat(" %-32.32s ", ToCharset(CHARSET_WIN1252, player[i].name, CHARSET_UTF8 ));
work
With notepad and wordpad the accent are ok and name aligned (problem solved after 5 years), but within my app (UTF8 encoded) they are disappeared. This last behaviour should be normal.
The new questions are now:
1) which CHARSET_WIN??? should I use for my text file in Windows in case of latin letter to accomodate the maximum number of accents (German, Italian, Danish, French...)?
2) do I need to convert even under Linux to prevent this problem?
I have no experience on this matter.
Luigi
[Updated on: Wed, 07 September 2011 08:35] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sat Jun 15 23:37:06 CEST 2024
Total time taken to generate the page: 0.01654 seconds
|
|
|