Mayayana
6/15/2016 12:16:00 AM
| You can always use the ADO Stream object for such things.
|
I started out with ADODB.Stream, but it doesn't
seem to work the way that most people think it does.
I found it was only converting UTF-8 to ANSI when
I first ran it through IE and only processed the displayed
text. I couldn't get it to go from UTF-8 to ANSI in
any configuration, despite many people showing
sample text that they claimed works.
In any case, the methods I came up with require
nothing extra, and work well. The Textstream idea
was actually from Microsoft. WiToANSI.vbs is in the
SDK and works on 16-bit unicode. Not surprisingly, it
only works exactly the way that MS wrote it. Textstream
is a very funky object that tries to make dealing with
text files transparent, but in doing so it does weird things.
For instance, ReadAll and Write fail when they encounter
Chr(0), but Read(number) and WriteLine don't.
I'm guessing the problem may be that 16-bit unicode
<-> ANSI is workable in a number of ways, but not so
with UTF-8.