# [texworks] TeXworks through TeX Live on Windows with multi-byte username

Stefan Lo"ffler st.loeffler at gmail.com
Mon Jan 5 17:52:28 CET 2015

```Hi,

thank you for reporting this issue (and analyzing it in detail). I will

On 02.01.2015 15:00, KUROKI Yusuke wrote:
> When the user name has Japanese
> character(s), the beginning of the procedure of TeXwork's initial
> procedure might use
>   %USERPROFILE%\.texlive????\texmf-config\texworks
> as the user's configure setting (and create the directory if not existing);
> however, the later process might not uses the directory but uses
>   %USERPROFILE%\TeXworks
> as its setting.  The latter place is the default setting of the
> TeXworks stand alone which means directly executing
> tlpkg/texwoks/texworks.exe

Yes. The latter one is the default. There are two possibilities why this
is chosen.
1) it is not overridden (by config files, environment variables, etc.)
2) it is overridden, but the override directory is not recognized/does

>From you analysis below, I assume it's reason 2 in your case.

> We are reading some of the codes of TeXworks rapidly,
> and guess this behavior comes from Qt library, but it is not
> sure whether it is under control of the developer's thought.
>   The source code which I have read is
>     /svn/texlive/trunk/Master/source/texworks-0.4.4-r1004.tar.gz .
>   You would concentrate Lines 144--149 and 886 in src/TWApp.cpp .

The lines around 149 are indeed the ones responsible for reading the
environment variables that override where settings and resources are
located.
Line 886 calls another function that should return the path to the
configuration, but it does not read the environment variables anymore
(that is done around line 149).
There are a few other places where environment variables are read, but
they should not influence your specific issue (though it might, e.g.,
influence which scripting plugins are found, etc.).

>   You could reproduce the problem by override the TW_LIBPATH
>   in texmf.cnf (under CP932 encoding) as
>   -  TW_LIBPATH = \$TEXMFCONFIG/ああああ/texworks
>      ... C:\Users\<USERNAME>\texworks would be used for user setting.
>      would be natural.
>   - TW_LIBPATH = \$TEXMFCONFIG/だめと噂の名/texworks
>     ... C:\Users\<USERNAME>\texworks would be used too.
>
> Is the behavior intended?

No. This was a problem with how environment variables were read. It
should be fixed in r1392. Note that it might take a while (possibly even
to the next release) before TeXLive picks this up.
In any case, this should fix the environment variable issue, i.e., if
you set TW_LIBPATH as environment variable and then run the new version
of TeXworks (not the TeXLive wrapper). I don't know exactly how the
TeXLive wrapper works, but my guess is that they work via (temporarily)
setting the environment variables. If that is indeed the case (and they
use the right, i.e., system encoding), the problem should be resolved now.

Note that I only tested this with my (German) version of Windows. It
would be great if you could let me know if it works for you (with
manually setting the environment variables) with the new version
(available for testing at