Hey Jeffrey,
Indeed from my understanding you'd need to imbue that stream with a locale
with the proper utf8-to-wchar conversion facet. I don't know by heart how
to do this, but google may find it for you.
What I tend to do, is use normal (the non-w version) strings and streams,
and then use Wt's UTF8 methods to do the proper conversion. For this case,
it seems that std::wstring Wt::fromUTF8(std::string &) from WStringUtils is
usable without much hassle.
BR,
Wim.
2014-10-04 5:54 GMT+02:00 Jeffrey Scott Flesher Gmail <
jeffrey.scott.fles...@gmail.com>:
> I am reading in xml files that look like this:
> <?xml version="1.0" encoding="UTF-8" ?>
> <menusman>
> <menuman name="首页"></menuman>
> </menusman>
>
> This function works fine for English,
> but when they hit the first Chinese character, the file handle returns a fail,
> which causes the loop to exit before it reads in the file.
>
> std::wstring line;
> std::wifstream myfile ("filename.xml");
> std::wstring myTemplate;
> if (myfile.is_open())
> {
> while (getline (myfile, line))
> {
> myTemplate.append(line);
> }
> myfile.close();
> }
>
> If I add:
> std::locale::global(std::locale(""));
> before opening the file, it works fine,
> but the app starts behaving strange,
> I get:
> ?wtd=0hI0BFZV1efPPIGw&signal=s89
> on the path, and the style sheets do not load,
> I tried to set setLocale(""), but it did not help,
> does anyone know how to fix this?
>
> Maybe I need to use imbue,
> but no luck at that so far.
>
> Thanks
> Jeff Flesher
>
>
>
>
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
------------------------------------------------------------------------------
Slashdot TV. Videos for Nerds. Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest