Re: Getting TextEdit to Recognise UTF-8 Output [solved]
Re: Getting TextEdit to Recognise UTF-8 Output [solved]
- Subject: Re: Getting TextEdit to Recognise UTF-8 Output [solved]
- From: Darcy Otto <email@hidden>
- Date: Fri, 21 May 2010 21:21:08 -0700
Bingo. Completely and utterly solved. Thanks Gus!
I was writing to the file with:
[[textStream dataUsingEncoding:NSUTF8StringEncoding] writeToFile:[sheet filename] atomically:YES];
Now, I'm writing with:
[textStream writeToFile:[sheet filename] atomically:YES encoding:NSUTF8StringEncoding error:&error];
When using the latter, TextEdit picks up the encoding, no problem.
On 2010-05-21, at 12:48 PM, Gus Mueller wrote:
> On May 21, 2010, at 12:42 PM, K.Darcy Otto wrote:
>
>> [textStream appendFormat:@"%C%C%C",0x00EF,0x00BB,0x00BF]; // textStream is an empty NSMutableString that gets added to, and then written to a file
>
>
> How are you writing the string to a file? Are you using NSString's writeToFile:atomically:? I'm pretty sure that doesn't write it out as UTF8. You'll probably want to use writeToFile:atomically:encoding:error: with NSUTF8StringEncoding as the encoding if you aren't already.
>
> -gus
>
> --
>
> August 'Gus' Mueller
> Flying Meat Inc.
> http://flyingmeat.com/
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden