discuss-gnustep
[Top][All Lists]
Advanced

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

UTF8 encoding!


From: ramana rao
Subject: UTF8 encoding!
Date: Tue, 2 Oct 2001 15:42:21 +0530

 
Hi All,
 
    We are using GNUstep lates snapshot ffrom CVS as it is on 26 th september. But we are getting problems with UTF8 encoding when encounters JIS characters, can anybody give a clue on this. The following some detailed description of this problem
 
thanks
 
Ramana Rao
 
**********
    We made firther investigation on this problem, and confirmed our initial guess, that the problem was with GNUstep UTF8 encoding. To summarize, the problem was coming becuase, UTF8 encoding on GNUstep is not supporting JIS character sets. We need to know what happens with other character sets like EUC-JIS etc.. as well.
 
The following is our experminets and deductions for this conclusion.
 
 Basically we have taken the OVistaServerConfig file which was giving the problem. Actually we removed the rest of the file and kept the only line which was giving the problem. I am attaching the file. We noticed another thing these special characters are used only bu LOM alarm server because it uses JIS encoding, OVistaServerConfig mentions this when it mentions the filter for LOM
 
Now the notes is,
This file can be loaded as a string in OpenStep using either ASCII encoding or UTF8.
But on GNUstep this file can be loaded as a string using only in ASCII encoding, it is failing to load if we use UTF8 encoding, the cominhg exception was 
 
"Uncaught exception NSCharacterConversionException, reason: Can't get cString from Unicode string."
 
 
We wrote the following small program, and tested both on OpenStep and GNUstep and both encodings ASCII and UTF8
 
 
*******************************************************************************************************
 
#import <Foundation/Foundation.h>
 
int main (int argc, const char *argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    NSData *theData;
    NSString *theStr;
    NSDictionary *thePlist;
    // insert your code here
    NSLog(@"specialConfigFile");
    theData = [[NSFileManager defaultManager] contentsAtPath :@"/u01/ramana/OVistaServerConfigX.plist"];
    NSLog(@"theData = %@",theData);
 
// Change thge following encoding to ASCII to make it work for the same config file
     theStr = [[NSString alloc] initWithData:theData encoding:NSUTF8StringEncoding];
     NSLog(@"theStr = %@",theStr);
     thePlist = [theStr propertyList];
     NSLog(@"thePlist = %@",thePlist);
    [pool release];
    exit(0);       // insure the process exit status is 0
}
****************************************************************************************************************
 
 
May be we can use the following hard coded string as well to verifiy with this program

{ 

Delimiters = ("/ \t\rĂ£€€");

}

****************************************************************************************************************
 
 
thanks
 
Ramana Rao
 
 

reply via email to

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