
At Wed, 19 Jan 2011 22:15:10 +0200, Peter Dimov wrote:
Dave Abrahams wrote:
At Wed, 19 Jan 2011 19:09:48 +0200, Peter Dimov wrote:
The problem with using an Unicode string, be it QString or utf8_string, to represent paths is that it forces you to pick an encoding under POSIX. When the OS gives you a file name as char*, to store it in your Unicode string, you have to interpret it. Then, to give it back to the OS, you have to de-interpret it.
Nonono; if you don't want to choose an encoding, you store it as a raw_string, (a.k.a. std::string, for example)!
OK. You're designing a portable library that talks to the OS. It has the following functions:
T get_path( ... ); void process_path( T );
What do you use for T? string or utf8_string?
I'm even less of an expert on encodings at the OS boundary than I am on an expert on encodings in general, but I'll take a shot at this one. OK, according to all the experts (like you), we should be trafficking in UTF-8 everywhere, so I guess I'd say T is utf8_string (well, T is boost::filesystem::path, but that begs the same questions, ultimately). -- Dave Abrahams BoostPro Computing http://www.boostpro.com