Thursday, July 13, 2006

i18n in Wt

I've been working on the i18n feature of Wt for the past few months though all my work still remains on the drawing board. I haven't integrated a single line of code yet to the repository. Wt is theoretically capable of displaying utf-8 but libxml++ seems not up to the job yet.The reason why Wt is not rendering unicode text from resources properly is that libxml++ throws a Glib::ConvertError exception if it encounters unicode characters. I think the libxml++ folks haven't resolved this issue yet even in the latest versions. The best solution? Switch to Xerces-C! More on that later.

1 comment:

Anonymous said...

If you want to display data for users, you must to initialize locale:

#include < clocale >
..

int main() {
std::setlocale(LC_ALL, "");
....

}


(this step required for output like "std::cout << nodeText->get_content() << std::endl;" and missed in the libxml++ examples).

If you want to get data from xml nodes in the fixed charset (UTF-8): for example to save it in a config file, -- use Glib::ustring.raw() :

std::cout << nodeText->get_content().raw() << std::endl;


ps: sorry for my silly english .