[PATCH] [3/6] Add support for non-utf8 file names in Path.inc

Yunzhong Gao Yunzhong_Gao at playstation.sony.com
Wed Sep 18 16:25:45 PDT 2013

ygao added you to the CC list for the revision "[3/6] Add support for non-utf8 file names in Path.inc".


File names on Windows may be system-locale encoded instead of UTF-8. For
example, the default encoding on a Japanese Windows environment is shift-JIS.
This patch modifies UTF8ToUTF16() to fall back to the OEM code page (system
locale) when UTF-8 fails to match. UTF8ToUTF16() is renamed to ExternToUTF16()
to reflect the new reality. This patch allows various llvm::sys::fs utilities
like status() or exists() to be applicable on foreign Windows environment.
This is part of a bigger effort to support foreign characters in file names.

Could someone take a look whether this is good to go in?

Many thanks,
- Gao.

Regarding the added parameter useSysLocale to ExternToUTF16():
This parameter defaults to true in this patch, meaning that we always fall back
to system locale when the string does not appear to be UTF8. We could
potentially make it more strict. If the file manager saves file names in UTF8,
then we only need to translate from system locale when the file name comes
directly from the command line. I see that Nikola is working on a patch that
translates arguments to UTF-8 at command-line argument parsing stage.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1295.3.patch
Type: text/x-patch
Size: 8120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130918/4c61652a/attachment.bin>

More information about the llvm-commits mailing list