from the ksh93t RELEASE file

08-12-04  A bug in which printf "%d\n" "'<euro>'" did not output the
          numerical value of the EURO symbol, 8354, has been fixed.

On Mon, 13 Dec 2010 10:05:48 -0800 Eric Peterson wrote:
> I came across the following snippet and attempted to test it with UTF-8 
> characters. but I get "[ᓄ] 0xprintf: warning: 'ᓄ': invalid character 
> constant" on my Mac, but on a linux box I get what I expected "[ᓄ] 0x14C4". 
>  Both systems have the LANG set to UTF-8 (see below).

> The difference I do see is that the linux box is "Version AJM 93t+ 
> 2010-02-02" and the Mac is "Version M 1993-12-28 s+".  Was printf fixed in 
> 93t?

> I did some googling and could not find much about this error, other then some 
> folks do get it, even in Java and C. But no resolution or workaround was 
> identified. I'd like to write machine independent code that would work both 
> my mac and various linux boxes (i386 GNU/Linux, Solaris, AIX linux, Redhat, 
> Ubuntu, Oracle Enterprise Linux [a flavor of Redhat], etc).

> #!/usr/bin/env ksh93

> str="ᓄᓇᕗᒻᒥᐅᑦ,ᓱᓴᓐ ᐊᒡᓗᒃᑲᖅ"

> for (( i=0; i < ${#str}; i++ ))
> do

>    c=${str:$i:1}
>    if [[ $c == ' ' ]]
>    then
>       printf "[%s] 0x%X\n" " " \'\ \'
>    else
>       printf "[%s] 0x%X\n" "$c" \'$c\'
>    fi

> done
> exit 0

> NLS_LANG=AMERICAN_AMERICA.AL32UTF8
> LANG=en_US.UTF-8
> LC_ALL=en_US.UTF-8
> LC_CTYPE=en_US.UTF-8

> Thanks for any insight ya'll can provide.
> Eric

> _______________________________________________
> ast-users mailing list
> [email protected]
> https://mailman.research.att.com/mailman/listinfo/ast-users

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to