Boost logo

Boost Users :

From: John Meinel (boost_at_[hidden])
Date: 2004-07-02 10:22:26

David Abrahams wrote:

> Sure; by the same token we could also use utf-8 and encode your
> Unicode in narrow strings.
Actually, I was wondering why this isn't used? The "big" advantage for
UTF-16 was that it followed the one char->one code point. But then that
was broken with the new UNICODE spec. So why not stick with utf-8. I
know that most Linux file systems will support utf-8 (if your terminal
supports it, then you see the nice characters, otherwise you see really
bad "ASCII" ones.)

I know there is a gnome library with a Glib::ustring that I believe
internally uses a utf-8 string.

However, isn't utf-8 fully compatible with std::string? Provided that
you understand some "characters" take more than one char? But that only
matters when you are trying to interpret what the string means, which is
done by the OS, or by something that is rendering it on the screen.

I suppose you still have to convert whenever you call one of the
OpenFileW commands. And probably that is what all this is about. Someone
feels that everything should be handled in the "native" format (which on
Win32 is some sort of wchar_t, and on other platforms is char (though a
UTF-8 char)).

My personal vote is to have the library convert to whatever internal
representation is considered "preferred", and then have the convenience
functions for converting to whatever the user wants. (native_file_wstring).

I don't think templated makes sense, since boost::filesystem is a
library, not just a collection of headers.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at