[PATCH] Add getenv() wrapper that works on multibyte environment variable.

Rui Ueyama ruiu at google.com
Thu Sep 5 17:16:17 PDT 2013


On Windows, character encoding of multibyte environment variable varies
depending on settings. The only reliable way to handle it I think is to use
GetEnvironmentVariableW().

GetEnvironmentVariableW() works on wchar_t string, which is on Windows UTF16
string. That's not ideal because we use UTF-8 as the internal encoding in LLVM.
This patch defines a wrapper function which takes and returns UTF-8 string for
GetEnvironmentVariableW().

The wrapper function does not do any conversion and just forwards the argument
to getenv() on Unix.

http://llvm-reviews.chandlerc.com/D1612

Files:
  include/llvm/Support/ConvertUTF.h
  include/llvm/Support/Environ.h
  lib/Support/CMakeLists.txt
  lib/Support/ConvertUTFWrapper.cpp
  lib/Support/Environ.cpp
  unittests/Support/CMakeLists.txt
  unittests/Support/EnvironTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1612.1.patch
Type: text/x-patch
Size: 7711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130905/993fbcb3/attachment.bin>


More information about the llvm-commits mailing list