Mixing extended character sets in ANSI C

John Kwan uunet!hpclbis.cup.hp.com!jkwan
Wed Mar 2 11:16:26 PST 1994


The C Standard specifies the support of extended character sets and locale
specific behaviour. However, the Standard does not mention anything about
codesets.

Consider the following program :

> main()
> {
>         setlocale (LC_ALL, "japanese");
>         printf("taC\n");     /* this is a SJIS string */
>         printf("%U%!%$%k%n");     /* this is a EUC  string */
> }

The program sets the locale to be "japanese" and defines two strings. One
of the strings uses Shift JIS characters and the other uses EUC which is
a totally different encoding. I cannot find anything in the Standard to
allow this. Is this a violation of ANSI rule (if so, which one) ? Or is
this fall into "locale specific behaviour" ? Comments ?

John W. Kwan 
California Language Lab
Hewlett-Packard Company
Cupertino, California



More information about the Numeric-interest mailing list