
Ferdinand Prantl wrote:
Hi,
I would prefer to use the standard types like std::string and char * as well.
However, I do not like much the idea about a fixed encoding, UTF-8 or something else. It is possible to use any encoding in std::string and even in std::wstring.
What do you think about imbuing and codecvt-like approach in boost::filesystem for the names of the files?
I don't (personally) care for it. More and more libraries and standards are using UTF-8 (for good reason) these days. It's a nice, simple, and flexible encoding.
It has a standard interface for the content of streams, it could serve also the filenames. Not all platforms support UTF-8 filenames, sometinmes could it serve as name mangling support.
Win32 doesn't support UTF-8 filenames natively. That's why boost::filesystem would have to convert t o/from UCS-2 along Win32 interface boundaries. If you're concerned about other platforms, you shouldn't be. boost::filesystem currently works only with latin encodings in ascii strings so no functionality would be taken away. The UTF-8 representation of ascii strings is identical, so if you already use ascii strings, nothing will change, and nothing will break. If you want your application to be runnable in multiple countries though, an operating system which boost::filesystem has translations defined for would be required. Linux is UTF-8 natively (assuming the right environment variable is set), so boost::filesystem would just pass everything through as-is. The Win32 poet would have to make some simple conversions (Windows even has built-in functions to perform this conversion) . Other platforms might have to have make other conversions to/from UTF-8, but assuming that platform supports Unicode at all, this is a no-brainer. Patrick Bennett