Re: UTF8 encoding
Adam Fedor <[email protected]>
| Newsgroups | gmane.comp.lib.gnustep.applications |
|---|---|
| Organization | Digital Optics |
| Message-ID | <[email protected]> |
ramana rao wrote:
> /******************************************************************/
>
>
> #import <Foundation/Foundation.h>
>
>
>
> int main (int argc, const char *argv[])
> {
> NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
>
>
>
> // insert your code here
> NSString *aString = @"HelloRamana�宿";
> NSString *bString = nil;
> NSData *stringData;
>
>
>
> NSLog(@"the First String = %@",aString);
> stringData = [aString dataUsingEncoding: NSUTF8StringEncoding];
> NSLog(@"the Second data = %@",stringData);
>
> bString = [[NSString alloc] initWithData:stringData
> encoding:NSUTF8StringEncoding];
> NSLog(@"the Third String = %@",bString);
>
> [pool release];
> exit(0); // insure the process exit status is 0
> }
> /**********************************************************/
>
>
This work fine for me on GNU/Linux. It also works for me on Solaris if I
change the unicode encoding constant to "UCS-2". The problem is I'm not
sure if that is correct or if I should only change it for Solaris
machines. I'm hoping that Fred Kiefer, who wrote this support, might
have more insight into what's right.