|
David Burgess a écrit :
Mike Pall wrote:The recipe for portability is to ignore the locale and do everything in UTF-8 internally (e.g. for string handling). Only convert at the boundaries to/from the 'widest' API available (e.g. for file I/O or GUIs).I have used this scheme and it works well for file names. I used MultiByteToWideChar() just prior to file name usage. The only place it presents some overhead is in directory iterators.
Yes, I was about to point out these functions:MultiByteToWideChar <http://msdn.microsoft.com/library/en-us/intl/unicode_17si.asp> WideCharToMultiByte <http://msdn.microsoft.com/library/en-us/intl/unicode_2bj9.asp> They seems to be the canonical way to do conversions between various locales, UTF-8 (and even UTF-7) and UTF-16 (native Windows Unicode).
-- Philippe Lhoste -- (near) Paris -- France -- http://Phi.Lho.free.fr -- -- -- -- -- -- -- -- -- -- -- -- -- --