|
From: | ramana rao |
Subject: | UTF8 encoding |
Date: | Tue, 18 Sep 2001 20:19:47 +0530 |
Hi All,
Here we have an application where we need to deal with
UTF8 data.
In GNUstep we could add 'libiconv' library which i think
supports UTF8 encoding.
I wrote a small program to test UTF8 encoding. We have a
string here which has UTF8 characters, i am converting it in to data using
encoding UTF8 and again converting the data back to string. If i run this
application on OpenStep, it is giving proper results but on GNUstep it is
failing to convert.
But if the string doesnot contain UTF8 characters this
application works fine in GNUstep.
Please suggest,
/******************************************************************/
#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 = ""> bString = [[NSString alloc] initWithData:stringData encoding:NSUTF8StringEncoding]; NSLog(@"the Third String = %@",bString); [pool release]; exit(0); // insure the process exit status is 0 } /**********************************************************/ Thanks for any help i may get
Ramana Rao
|
[Prev in Thread] | Current Thread | [Next in Thread] |