Hey Markus,

2009/6/18 [email protected] <[email protected]>
>
> hi,
>
> i have got the problem that Ä, Ü and Ö cannot be displayed in a valid
> way. my text inside my witty application has to be conform of the german
> language, which isnt. all the time i did not use setLocale, and i still
> have problems using this function to diplay mutated vowels.

setLocale() controls the localization aspects of Wt, to adapt strings
to a local translation.

> Where does the witty application gets the local settings if i do not use
> setLocale() ?

It gets the locale from the WEnvironment, which in turns fetches it
from the browser settings. But most of the time, browsers will report
English (even if the user does not speak English natively). You can
change the locale using setLocale().

But, the problem you face is not so much a localization issue, but
rather an internationalization issue: you want to display text from a
non-ascii7 character set.

You two choices to make Wt display any unicode character:

1) use WString::fromUTF8() with a UTF8 encoding of the character. For
example, the UTF8 representation for Ü is
0xc3 0x9c.

2) use WString::tr() and specify the value in an XML file with e.g.
character UTF8 encoding. The benefit is that you can use any XML
editor to edit the file without worrying about the encoding: WYSIWYG.

The latter has the benefit that it also will open the way to having
proper localization perhaps later on for your application, where you
make an XML file per language.

Wt internally uses UTF8 to represent unicode strings and also
communicates using UTF8 with the browser, so unless you have other
reasons, UTF8 is a good choice for dealing with unicode characters
everywhere.

> WString::tr sets my keys in "?? key ??" so it cant get the local
> settings. so whats wrong with it?

You need to create an XML file which contains values for your keys,
and use wApp->messageResourceBundle().use(). Many examples use this
method to push strings (or pieces of HTML) to XML files. See for
example the homepage, or the simplechat example for how this works.

I hope this helps (what will for sure help is unicode support in C++0x !).

Regards,
koen

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to