Encoding problem of retrieving output of an external program

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Encoding problem of retrieving output of an external program

adah
Currently I am having a problem with the encodings on Windows.

I have a script that does something like follows:

let @z = system("SomeCommand")
normal "zP

This works as expected if encoding is set to the external `ANSI' code
page (assuming SomeCommand always displays `ANSI' content).  However,
when I use encoding=utf-8 (as I normally do), this does not work --- all
MBCS characters are corrupt.

The only workaround I currently know is to employ iconv as
"SomeCommand|iconv -t utf-8".  However, I want to know whether there is
a smarter way (like fileencodings), best w/o the requirement of the
existence of iconv.exe.  Any suggestions?

Best regards,

Yongwei