diff --git a/Docs/src/config.but b/Docs/src/config.but
index ad1da046..d956928e 100644
--- a/Docs/src/config.but
+++ b/Docs/src/config.but
@@ -8,3 +8,13 @@
\preamble Quick links:\\
\W{http://nsis.sourceforge.net/support/faq/}{FAQ} - A list of frequently asked questions\\
\W{http://nsis.sourceforge.net/wiki/}{NSIS Wiki} - Examples, functions, tutorials, plug-ins, software and more\\
\W{http://forums.winamp.com/forumdisplay.php?forumid=65}{Forum} - Post questions or discuss NSIS features
+\define{NsisFuncReqU} This function is only available when building a \R{intro-unicode}{Unicode installer}.
+
+\define{NsisACPcp} system default ANSI codepage (ACP)
+
+\define{NsisWarnBlockContainerBegin} \\
+
+\define{NsisWarnBlockContainerEnd} \\
+
+\define{NsisBlockHeaderExeheadU} \\Unicode: \\
+
diff --git a/Docs/src/file.but b/Docs/src/file.but
index 657fb85e..de50f6f8 100644
--- a/Docs/src/file.but
+++ b/Docs/src/file.but
@@ -23,7 +23,12 @@ If no absolute path is specified the current folder will be used. The current fo
Reads a string (ANSI characters) from a file opened with \R{FileOpen}{FileOpen}. The string is read until either a newline (or carriage return newline pair) occurs, or until a null byte is read, or until maxlen is met (if specified). By default, strings are limited to 1024 characters (a special build with larger NSIS_MAX_STRLEN can be compiled or downloaded). If the end of file is read and no more data is available, the output string will be empty, and the error flag will be set.
-(If you are building a \R{intro-unicode}{Unicode installer}, the function reads an ANSI string and makes the adequate conversion)
+\NsisWarnBlockContainerBegin
+\NsisBlockHeaderExeheadU
+\#{This is a bug in exehead but it is probably a good idea to document it here...}
+The \R{intro-unicode}{Unicode} version can only read text encoded with a single byte character set! The \NsisACPcp is used during the conversion.
+\NsisWarnBlockContainerEnd
+
\c ClearErrors
\c FileOpen $0 $INSTDIR\file.dat r
@@ -37,7 +42,7 @@ Reads a string (ANSI characters) from a file opened with \R{FileOpen}{FileOpen}.
\c handle user_var(output) [maxlen]
-This function is only available when building a \R{intro-unicode}{Unicode installer}.
+\NsisFuncReqU
Reads a string (UTF-16LE characters) from a file opened with \R{FileOpen}{FileOpen}. The string is read until either a newline (or carriage return newline pair) occurs, or until a null wide-character is read, or until maxlen is met (if specified). By default, strings are limited to 1024 characters (a special build with larger NSIS_MAX_STRLEN can be compiled or downloaded). If the end of file is read and no more data is available, the output string will be empty, and the error flag will be set.
@@ -68,7 +73,7 @@ Reads a byte from a file opened with \R{FileOpen}{FileOpen}. The byte is stored
\c handle user_var(output)
-This function is only available when building a \R{intro-unicode}{Unicode installer}.
+\NsisFuncReqU
Reads a word (2-bytes) from a file opened with \R{FileOpen}{FileOpen}. The word is stored in the output as an integer (0-65535). If the end of file is read and no more data is available, the output will be empty, and the error flag will be set.
@@ -115,7 +120,7 @@ Writes an ANSI string to a file opened with \R{FileOpen}{FileOpen}. If an error
\c handle string
-This function is only available when building a \R{intro-unicode}{Unicode installer}.
+\NsisFuncReqU
Writes a Unicode (UTF-16LE) string to a file opened with \R{FileOpen}{FileOpen}. If an error occurs writing, the error flag will be set.
@@ -141,7 +146,7 @@ If an error occurs while writing, the error flag will be set. Note that the low
\c handle string
-This function is only available when building a \R{intro-unicode}{Unicode installer}.
+\NsisFuncReqU
Writes the integer interpretation of 'string' as a WORD (2-bytes, range: 0-65535) to a file opened with \R{FileOpen}{FileOpen}. Of course you can enter the integer value directly. The following code writes a "Carriage Return / Line Feed" - Enter to the file.
diff --git a/Docs/style.css b/Docs/style.css
index dea58c89..bd7ded6f 100644
--- a/Docs/style.css
+++ b/Docs/style.css
@@ -42,4 +42,10 @@ a:hover {
background-color: #F4F4F4;
color: #000000;
text-decoration: underline;
+}
+.wb {
+ background-color: #FFFFCC;
+ color: #000000;
+ border: 1px solid #646400;
+ padding: 0.2em;
}
\ No newline at end of file
diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c
index 51e3e08c..397d377e 100644
--- a/Source/exehead/exec.c
+++ b/Source/exehead/exec.c
@@ -1417,9 +1417,13 @@ static int NSISCALL ExecuteEntry(entry *entry_)
#ifdef _UNICODE
if (which==EW_FGETS)
{
+ /* BUGBUG:
+ How is MBTWC supposed to be able to determine the correct WCHAR for a multibyte string when it only has 1 byte to look at?
+ And what if the multibyte character needs two WCHARs?
+ */
char tmpc;
if (!ReadFile(h,&tmpc,1,&dw,NULL) || dw != 1) break;
- MultiByteToWideChar(CP_ACP, 0, &tmpc, 1, &c, 1);
+ if (0==MultiByteToWideChar(CP_ACP, 0, &tmpc, 1, &c, 1)) c = _T('?');
}
else
#endif