String encoding
String encoding
- Subject: String encoding
- From: Aidas Dailide <email@hidden>
- Date: Tue, 25 Feb 2003 23:28:17 -0800
Hi,
I want to convert NSString that contains some Central European
characters to Mac OS Central European encoding and copy it to
clipboard, so it can be used by applications such as MS Word and
others. Here is my code:
-(NSString*)unicodeToAppleCe:(NSString*)str
{
NSString* returnString;
NSStringEncoding encod;
encod =
CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingMacCentralEur
Roman);
//just for debugging
if ([str canBeConvertedToEncoding:encod]) NSLog(@"it is ok to convert");
NSLog([NSString localizedNameOfStringEncoding:encod]);
//end
returnString=[[NSString alloc] initWith
Data:[str
dataUsingEncoding:encod] encoding:encod]; //is this one correct?
return returnString;
}
Maybe my NSString losses encoding information when I am copying it to
clipboard? What is the correct way to copy it to clipboard without
lossing encoding information?
Thank you,
AIdas
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.