diff --git a/Docs/src/compiler.but b/Docs/src/compiler.but index 38b80de2..2fa27c7f 100644 --- a/Docs/src/compiler.but +++ b/Docs/src/compiler.but @@ -8,7 +8,7 @@ These commands are similar to the C preprocessor in terms of purpose and functio \# NOTE: \NsisInputCharset define cannot be used in a \c block -\c [/NONFATAL] [/CHARSET=ACP|OEM|CP#|UTF8|UTF16LE] file +\c [/NONFATAL] [/CHARSET=ACP|OEM|CP#|UTF8|UTF16LE|UTF16BE] file This command will include 'file' as if it was part of the original script. Note that if a file is included in another directory, the current directory is still where the script was compiled from (not where the included file resides). If the compiler can't find the file it will look for it in every include directory. See \R{addincludedir}{!addincludedir} for more information. If the /nonfatal switch is used and no files are found, a warning will be issued instead of an error. /charset can be used to specify a codepage for plain text files without a BOM. diff --git a/Docs/src/config.but b/Docs/src/config.but index 8895e10a..8dd894b2 100644 --- a/Docs/src/config.but +++ b/Docs/src/config.but @@ -12,7 +12,7 @@ \define{NsisACPcp} system default ANSI codepage (ACP) -\define{NsisInputCharset} ACP|OEM|CP#|UTF8|UTF16LE +\define{NsisInputCharset} ACP|OEM|CP#|UTF8|UTF16LE|UTF16BE \define{NsisWarnBlockContainerBegin} \\
diff --git a/Source/utf.cpp b/Source/utf.cpp index ea373081..7557b6d6 100644 --- a/Source/utf.cpp +++ b/Source/utf.cpp @@ -36,11 +36,13 @@ UINT StrLenUTF16(const void*str) bool StrSetUTF16LE(tstring&dest, const void*src) { -#ifdef _WIN32 - dest = (wchar_t*) src; -#else -#error TODO: UTF16LE to wchar_t +#ifndef _WIN32 + CharEncConv cec; + if (!cec.Initialize(-1,NStreamEncoding::UTF16LE)) return false; + src = (const void*) cec.Convert(src); + if (!src) return false; #endif + try { dest = (wchar_t*) src; } catch(...) { return false; } return true; }