Shigeharu TAKENO <shige@...> wrote
> On Solaris 9, nl_langinfo(CODESET) of system library returns:
> locale = ja, ja_JP.eucJP => "eucJP"
> locale = ja_JP.PCK => "PCK"
Thank you for mentioning nl_langinfo(). I did not know about that routine.
On Solaris 9 does iconv_open() accept "PCK" as an encoding name?
We don't care what the name is, we only care that iconv() can use it.
So if nl_langinfo(CODESET) returns "PCK"
and iconv_open( "PCK", "ISO-8859-1" ) works correctly
then this method seems OK.
We will have to check for nl_lanfinfo() in the configure script,
but that's not a problem.
Ethan
> Ethan A Merritt <sfeam@...> wrote:
> | I have revised the new code to use iconv() if it is available.
> | I tested under linux by setting the locale to ja_JP.EUC-JP,
> | which causes it to emit the character sequence \241 \353 (octal)
> | which is 0xA1EB (hexidecimal). But I don't have any EUC-JP fonts
> | installed, so I cannot confirm if this is correct.
>
> The code 0xA1EB is correct for EUC-JP.
>
> Well, I think the idea
>
> + if (locale) {
> + /* This should work even if gnuplot doesn't understand the encoding */
> + char *encoding = strchr(locale, '.');
> + if (encoding) {
> + encoding++; /* Step past the dot in, e.g., ja_JP.EUC-JP */
>
> of src/set.c is not so good, since substrings of locale name
> after '.' may not proper name of the character encoding. For
> example, in Solaris 9,
>
> EUC-JP enconding locale name = "ja", "ja_JP.EUC", "ja_JP.eucJP"
> Shift_JIS encoding locale name = "ja_JP.PCK"
> UTF-8 encoding locale name = "ja_JP.UTF-8"
>
> To obtain encoding codeset name of current locale, there seems to
> be two methods:
>
> 1) Use nl_langinfo(CODESET) (#include <langinfo.h>)
> 2) Use locale_charset() (#include <localcharset.h>) in libcharset,
> which is included in GNU libiconv.
>
> cf. http://www.haible.de/bruno/packages-libcharset.html
>
> On Solaris 9, nl_langinfo(CODESET) of system library returns:
>
> locale = ja, ja_JP.eucJP => "eucJP"
> locale = ja_JP.PCK => "PCK"
>
> and locale_charset() of GNU libcharset returns:
>
> locale = ja, ja_JP.eucJP => "EUC-JP"
> locale = ja_JP.PCK => "SHIFT_JIS"
>
> I think that names returned by locale_charset() may be better,
> but libcharset may not be installed in default.
>
>
> | If you build the new code, you can test it by saying
> | set encoding locale
> | show decimal
>
> Though it puts a incorrect string on "ja" locale, it works fine
> on "ja_JP.eucJP" locale since iconv library admits "eucJP".
>
> +========================================================+
> Shigeharu TAKENO NIigata Institute of Technology
> kashiwazaki,Niigata 945-1195 JAPAN
> shige@... TEL(&FAX): +81-257-22-8161
> +========================================================+
>
|