This behavior is not a bug, but rather a result of writing out binary text data in UTF-16 encoding. This is necessary to preserve line breaks and other special characters that may be contained in the text. The expectation is that the text will be written at a ratio of 8 bits per-character, as in normal ASCII encoding. This is not the case, as UTF-16 uses 16 bits per-character, effectively doubling the size of the outputted text file.
In order to generate text files that are 8 bits per-character, you should use the CreateTextFile or OpenTextFile methods in order to return a TextStream object. When using CreateTextFile, you must set the Unicode property to False.
CreateTextFile ([in] Name, [in] OverWrite, [in] Unicode)
When using OpenTextFile, you must set the Format property to TriStateFalse or -1.
OpenTextFile ([in] Filename, [in] IOMode, [in] Create, [in] Format)
Either method will then write to the file in ASCII encoding. You must be sure that there will be no characters that are not in the ASCII character set, or they will not be written properly in the outputted file.
|