discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unicode and GNUstep (more info)


From: Richard Frith-Macdonald
Subject: Re: Unicode and GNUstep (more info)
Date: Fri, 10 May 2002 16:33:57 +0100

On Friday, May 10, 2002, at 03:26 PM, Andreas Hoeschler wrote:

Hi all,

the following program

       NSString *string = @"Höschler";
       NSLog(@"char: %d", [string characterAtIndex:1]);

returns

        FBTest[12919] char: 246

on MacOSX which is correct and

        FBTest[3076] char: 154

which is incorrect. How can this be fixed?

Two things ...

1. On my copy of GNUstep (Debian, Intel), the above test program prints 'char: 246' as
it does on your MacOS-X system.

2. What you are doing is actually illegal ... the contents of a constant literal string created using the @"" syntax are supposed to be ascii (ie 7-bt characters with the eighth bit clear). The behavior
when you use non-ascii characters is undefined.


That being said ...

The ö character has the value 246 in both unicode and ISO latin 1
The GNUstep default character encoding for C-strings is Latin 1

So it should (and on mys system does) work as you are expecting as long as you have not changed your default encoding (GNUSTEP_STRING_ENCODING environment variable), assuming you are using an
up to date copy of GNUstep of course.


So, if the GNUSTEP_STRING_ENCODING setting is not your problem, and you are using up to date software, it would be interesting to know about your machine/os, compiler etc.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]