Hello Marin,

2010/1/28 Marin Lukovic <[email protected]>:
> Hello,
>
> I'm using Unicode strings, generally they are works fine, except in
> WTreeView widget header.
>
> Problem is that if my string contains local characters (Croatian for
> example), header text is not shown at all.
>
> Here is existing code for setting header text (text_ is CString):
>
> model_->setHeaderData(0, Horizontal, std::string(CT2CA(text_)));
>
>

It is better to convert to Wt::WString. In your case, I think that
this should do the trick:
model_->setHeaderData(0, Horizontal, Wt::WString(CT2CW(text_)));
(note that I use CT2CW iso CT2CA)

The problem with converting international strings to a plain char *
string is that there is no standard encoding to store the result, and
it may or may not work for you. MSDN says: "By default, the ATL
conversion classes and macros will use the current thread's ANSI code
page for the conversion." If your threads code page can represent all
your special characters, your approach should work. WStrings work
internally as UTF8 encoded strings, and guarantees as such that the
meaning of your characters will not be modified. So the best way for
you is: CString to wchar_t* to WString (which stores it in UTF8). With
this, you have less risk to loose information during the conversions.

One thing bothers me, though.. you say the headers are completely
empty. Normally you'd see wrong characters... but please try this
first and let me know if it works.

Best regards,
Wim.

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to