apps-gnustep
[Top][All Lists]
Advanced

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

Re: UTF8 encoding


From: Adam Fedor
Subject: Re: UTF8 encoding
Date: Tue, 18 Sep 2001 11:36:22 -0600
User-agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:0.9.2) Gecko/20010630

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.






reply via email to

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