UTF8 encoding

"ramana rao" <[email protected]>
Newsgroups gmane.comp.lib.gnustep.applications
Organization Orillion
Message-ID <010201c14051$473c3020$7501a8c0@nalluri>

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 = %@",stringData);
    
    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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.