Because the c_str() still is a valid string. And ΓΌ is UTF-8 character 252, which should be in a valid range for a 8-bit stream. I would blame the rendering functions you use, or the usage of fonts of something.
Try use a unicode stream and pass it on to unicode text rendering methods and it should work. (Does these characters work in standart HL1 MP?) ----- Original Message ----- From: "Heimo Stieg" <gr...@corona-bytes.net> To: "Discussion of Half-Life Programming" <hlcoders@list.valvesoftware.com> Sent: Sunday, June 07, 2009 2:09 PM Subject: Re: [hlcoders] GoldSrc vgui::Label unicode problem > but the question is why does it work in the first place? > and also in the debugger i can see that c_str returns the characters > with umlauts :/ ( even on the not working label ) > > Jonas 'Sortie' Termansen schrieb: >> std::string::c_str() returns exactly what it says, a 8-bit ascii (UTF-8) >> string, which of course doesn't have any unicode support, because it's >> acsii. Get a wide character string pointer and use that one instead with >> a >> function that supports it. >> >> - Sortie. >> >> ----- Original Message ----- >> From: "Heimo Stieg" <gr...@corona-bytes.net> >> To: "hlcoders" <hlcoders@list.valvesoftware.com> >> Sent: Sunday, June 07, 2009 1:27 PM >> Subject: [hlcoders] GoldSrc vgui::Label unicode problem >> >> >> >>> Hi, >>> I want to add unicode to the normal ingame chat. On my custom input >>> label ( vgui::Label ) the characters are looking fine and everything is >>> working. >>> On the other hand i have also some vgui::Labels to display the chat, but >>> on these labels unicode characters like german umlauts will screw up. >>> Sometimes the labels won't draw any character after the unicode one( the >>> unicode character will be drawn ), or the labels writing the text over >>> the unicode characters( like these characters would have the width of >>> 0 ). >>> I'm storing everything in std::string. I change also only this variable >>> and on label->SetText im just using std::string::c_str(). >>> The error isn't somewhere in the network because i've also tryed to copy >>> the text directly from the input label to the chat label on the same >>> client. Result is the same :/ >>> >>> _______________________________________________ >>> To unsubscribe, edit your list preferences, or view the list archives, >>> please visit: >>> http://list.valvesoftware.com/mailman/listinfo/hlcoders >>> >>> >> >> >> _______________________________________________ >> To unsubscribe, edit your list preferences, or view the list archives, >> please visit: >> http://list.valvesoftware.com/mailman/listinfo/hlcoders >> >> > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders