[NTG-context] non-ascii chars in cmd.exe (Windows)

Pablo Rodriguez oinos at gmx.es
Fri Nov 13 21:01:59 CET 2020


On 11/13/20 3:15 PM, Hans Hagen wrote:
> On 11/13/2020 2:49 PM, Pablo Rodriguez wrote:
>> [...]
>> Since console input is UTF-16LE, I guess I may need something in Lua
>> similar to 'regimes.translate(str, "utf16le")'.
>
> the console uses whatever code page you have configured and it also
> relates to the code page used for filenames .. the 16 bit values are
> used deep down and what you use gets translated into that (often folks
> still use some 8 bit code page so that then gets mapped) .. there is no
> way the system can know if what you provide is as it's bytes in whatever
> encoding used
>
> so, you need to look what your system is configured for

I think that codepage is named locale codepage (as different from the
one in the console [or whatever chcp should change]).

I wonder whether this is named codeset in this Windows tool:

  > wmic os get locale, oslanguage, codeset
  CodeSet  Locale  OSLanguage
  1252     0c0a    3082

> (this is independent of the output to the console which is what the
> 65001 does)

It seems that UTF-8 as locale codepage is only available in Win10.

An easy workaround is to rewrite the batch file to:

 chcp 65001
 set /P "name=Name? "
 context --arguments="name={%name%}" document.tex

Many thanks for your help,

Pablo
--
http://www.ousia.tk


More information about the ntg-context mailing list