[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
encoding problems
From: |
reuss |
Subject: |
encoding problems |
Date: |
Sun, 29 Jun 2003 14:12:16 GMT |
User-agent: |
Pan/0.11.2 (Unix) |
i have an ascii textfile, delimited by '|', on the left side, there is
words that should be in latin1 encoding and the right side words that should be
latin2
encoding
i read the entire file in an NSString (myString), and applied
myArray=[myString componentsSeparatedByString: @"\n"];
then
for(i=0;i<[myArray count]; i++)
{
mySecondArray=[[myArray objectAtIndex:i]componentsSeparatedByString:
@"\n"];
just to have separetly the two string and convert then to the encoding
due.
myStringOne=[mySecondArray objectAtIndex:0];
myStringTwo=[mySecondArray objectAtIndex:1];
my problem is that if I nslog the following
NSLog(@"%@\n",mySecondArray);
I can see that I want to se (an unicode representation of the strings
in \Uxxxx format that I can put in myDict)
=("legy\U00f5z")
but if I nslog the following:
NSLog(@"%@\n",myStringTwo, I can see something terrible.
= legyõz
in the ascci file, there are some characters in the latin2 side that I
want to replace with the
myString=[myString stringByReplacingString: @"\U00f5" withString:
@"\U0151"); command (because in the text file, I could not use unicode
characters)
but with the stuff I can see with nslog, it is impossible
I tried
myStringTwo = [myStringTwo propertyList];
but then I only get the chars until the first accented characters
=legy
and tried too:
myStringTwo = [myStringTwo UTF8String];
and got:
= legyõz
and tried to
NSData *d = [NSData dataWithBytes: "legyõz" length: 6];
NSString s = AUTORELEASE([[NSString alloc] initWithData: d encoding:
NSLatin2StringEncoding]);
but the 's' was always 'nil'
How can I convert it to format "legy\U00f5z" in that I could replace the
characters I want and permits me to put the whole stuff in myDict?
thanks again
andras
- encoding problems,
reuss <=