Re: Re: default encoding on Japanese windows environment

Tatsuro MATSUOKA <[email protected]> Fri, 17 Dec 2021 07:57:02 +0900 (JST)
Newsgroups gmane.comp.graphics.gnuplot.devel
Message-ID <[email protected]>
Ethan

Thank you for your detailed explanation.
I surely have misunderstood the situation.

> So I think that to change the initial encoding in gnuplot, the user needs to either
> (1) set an appropriate environmental variable global to the session or
> (2) set the code page to CP65001.
> 
> Is there a good place to find instructions on how to do this?
> Should we add a section to the installation instructions or the user manual?

Behavior cp65001 of current windows 10 is changed before.
  past :Japanese font cannot be selected .IME input of Japanese characters is impossible
  now : Japanese font can be selected. IME input Japanese characters is possible.
I do not know when the above change ocurr.

I think that the user manual is appropriate.

Tatsuro

> ----- Original Message -----
>
> 
> On Thursday, 16 December 2021 11:50:25 PST Tatsuro MATSUOKA wrote:
> > We consider the case where there is no "set encoding xxxx" in GNUPLOT.INT and GNUTERM is not specified.
> > At start up, excution result of "show encoding"
> > Cygwin => default (Perhaps on Linux the same)
> > Windows (on Japanese env.) => sjis (ShiftJIS, old Japanese encording)
> > Windows (not Japanese env.) => I do not know
> > 
> > Now even on Windows standard text editor notepad.exe, default encoding is utf8 but not sjis.
> > Sjis encording is only for backward compatibility.
> 
> Are you sure this is set by the program and not by the system or user preferences?
>  
> > sjis being default encoding on windows on Japanese env. is better to be stopped.
> 
> So far as I know gnuplot would only start with encoding SJIS if the user's computer
> has current locale set to use sjis.
> 
> Gnuplot's initialization is done in routine encoding_from_locale() in file encoding.c.
> 
> It first tries to use the system function
> 	    l = setlocale(LC_CTYPE, "");
> 
> The man page says
>        If locale is an empty string, "", each part of the locale that should be  modified  is
>        set according to the environment variables.  The details are implementation-dependent.
>        For glibc, first (regardless of category), the  environment  variable  LC_ALL  is  in‐
>        spected, next the environment variable with the same name as the category (see the ta‐
>        ble above), and finally the environment variable LANG.  The first existing environment
>        variable is used.  If its value is not a valid locale specification, the locale is un‐
>        changed, and setlocale() returns NULL.
> 
> On linux an appropriate japanese locale string is "ja_JP.UTF-8"
> but I know that Windows uses different names for locales.
> 
> Do you know if your Japanese env. machine is returning a valid locale specification at this
> point?   If so, that is what gnuplot will use.   If no valid return is detected, the program
> then falls through to this code:
> #ifdef _WIN32
>     /* get encoding from currently active codepage */
>     if (encoding == S_ENC_INVALID) {
> #ifndef WGP_CONSOLE
>         encoding = map_codepage_to_encoding(GetACP());
> #else
>         encoding = map_codepage_to_encoding(GetConsoleCP());
> #endif
>     }
> #endif
> 
> So I think that to change the initial encoding in gnuplot, the user needs to either
> (1) set an appropriate environmental variable global to the session or
> (2) set the code page to CP65001.
> 
> Is there a good place to find instructions on how to do this?
> Should we add a section to the installation instructions or the user manual?
> 
> 
> 
> 
> 
> 
> 



_______________________________________________
gnuplot-beta mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta