Which function pair in QString to use for converting to/from std::string?
Posted
by
Noah Roberts
on Stack Overflow
See other posts from Stack Overflow
or by Noah Roberts
Published on 2011-01-03T18:03:25Z
Indexed on
2011/01/03
18:53 UTC
Read the original article
Hit count: 239
I'm working on a project that we want to use Unicode and could end up in countries like Japan, etc... We want to use std::string for the underlying type that holds string data in the data layer (see Qt, MSVC, and /Zc:wchar_t- == I want to blow up the world as to why). The problem is that I'm not completely sure which function pair (to/from) to use for this and be sure we're 100% compatible with anything the user might enter in the Qt layer.
A look at to/fromStdString indicates that I'd have to use setCodecForCStrings. The documentation for that function though indicates that I wouldn't want to do this for things like Japanese. This is the set that I'd LIKE to use though. Does someone know enough to explain how I'd set this up if it's possible?
The other option that looks like I could be pretty sure of it working is the to/fromUTF8 functions. Those would require a two step approach though so I'd prefer the other if possible.
Is there anything I've missed?
© Stack Overflow or respective owner