[texdoc] Weird behavior of `texdoc'

Manuel Pégourié-Gonnard mpg at elzevir.fr
Tue Feb 21 23:57:20 CET 2017

On 17/02/2017 00:22, Karl Berry wrote:
> So I guess what could be useful is a tweak to texdoc to set
>   env LESSCHARSET=utf-8 <pager>
> if the current locale contains "UTF-8". Oh, except that won't work on
> Windows (no env program). Maybe use putenv, if that's portable in Lua.
> You get the idea ...
Just checked the LuaTex reference, and it helpfully provides the
os.setenv() that is missing from stock Lua.

> This is already supposed to be the default, according to the man page:
>        If neither LESSCHARSET nor LESSCHARDEF is set, but any of the strings
>        "UTF-8", "UTF8", "utf-8" or "utf8" is found in the LC_ALL, LC_CTYPE or
>        LANG environment variables, then the default character set is utf-8.
> but evidently something is going awry somewhere ... -k
LuaTeX sets LC_CTYPE=C, according to my experiments and the LuaTex
reference (p. 43 in the 0.95.0 version):

> In stock Lua, many things depend on the current locale. In LuaTEX, we
> can't do that, because it makes documents unportable. While LuaTEX is
> running if forces the following locale settings:

Out of the top of my head it looks like it could make sense to do that
only in TeX mode (ie when invoked as 'luatex' or 'lualatex' etc), not in
Lua mode (as 'texlua'), but maybe I'm missing something. If you think
that makes sense, maybe someone who's more up-to-date than me about
LuaTeX things should raise this on the LuaTeX list.


More information about the texdoc mailing list