From: Konrad Kullig on
Use TCC/LE free command line interpreter (http://www.jpsoft.com).
This can run UNICODE (UTF-16, little endian) batch files.

Konrad


"ab`" <ab(a)absent.com> schrieb im Newsbeitrag
news:uZa98Wa2KHA.5212(a)TK2MSFTNGP04.phx.gbl...
> I'm working on an app that (among other things) writes batch files.
> Presently, the batch files are UTF-8 encoded, with BOM. The batch files
> work properly unless they include non-ANSI characters.
>
> For example, this doesn't work:
> "MyProg.exe" "??.data"
>
> Nor does this (a crude attempt to force UTF-8):
> chcp 65001
> "MyProg.exe" "??.data"
>
> I also tried forcing the parameter into 8-bit, which results in output
> like this (also doesn't work):
> "MyProg.exe" "�s"翻.data"
>
> Any ideas on how to best approach this problem?


From: Hector Santos on
ab` wrote:

> I'm working on an app that (among other things) writes batch files.
> Presently, the batch files are UTF-8 encoded, with BOM. The batch files
> work properly unless they include non-ANSI characters.
>
> For example, this doesn't work:
> "MyProg.exe" "的翻.data"
>
> Nor does this (a crude attempt to force UTF-8):
> chcp 65001
> "MyProg.exe" "的翻.data"
>
> I also tried forcing the parameter into 8-bit, which results in output
> like this (also doesn't work):
> "MyProg.exe" "çš„ç¿».data"
>
> Any ideas on how to best approach this problem?


I'm curious to how you created the batch file? What functions? If
you have control (by creating them), do they need to be in UTF8 w/ BOM?

--
HLS
From: ab` on
I was hoping I would have to resort to this, but the best answer may be
to write a mini-app that reads .bat files, then calls CreateProcess.
PowerShell can't be assumed to be installed on user machines.

On 4/12/2010 2:15 AM, Mihai N. wrote:
>> I'm working on an app that (among other things) writes batch files.
>> Presently, the batch files are UTF-8 encoded, with BOM. The batch files
>> work properly unless they include non-ANSI characters.
>
> The command line does not properly support Unicode batch files.
> And most of the command line tools don't understand Unicode either.
> The only solution is to try something else than the regular cmd.
> For instance PowerShell, or VB/JavaScript scripts.
>
>
>

From: ab` on
...."wouldn't have to"...

The real problem isn't the "的翻.data" file, which I can name anything,
it's that the file may be be in a non-ANSI folder (e.g. F:\的翻\的翻.data).
From: Joseph M. Newcomer on
THere is a /u switch to cmd that I was once told about, but I have not looked it up to see
what it does; I was told it (at least) causes the output to be in Unicode, but I have no
idea if it has any other effects.

I would be very surprised if it could handle UTF-8 encoded batch files, BOM or not. UTF-16
would be the best we could hope for.
joe

On Mon, 12 Apr 2010 02:15:07 -0700, "Mihai N." <nmihai_year_2000(a)yahoo.com> wrote:

>> I'm working on an app that (among other things) writes batch files.
>> Presently, the batch files are UTF-8 encoded, with BOM. The batch files
>> work properly unless they include non-ANSI characters.
>
>The command line does not properly support Unicode batch files.
>And most of the command line tools don't understand Unicode either.
>The only solution is to try something else than the regular cmd.
>For instance PowerShell, or VB/JavaScript scripts.
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm