Re: NSTextView with RTF as string?
Re: NSTextView with RTF as string?
- Subject: Re: NSTextView with RTF as string?
- From: j o a r <email@hidden>
- Date: Fri, 6 May 2005 15:17:20 +0200
On 6 maj 2005, at 14.32, John Timmer wrote:
I've got some RTF that I've generated manipulating a string's
contents in
code. I need to put that into a Text View. If I try the following:
[rtfText writeToFile: [@"~/Desktop/blurk.rtf"
stringByExpandingTildeInPath] atomically: YES];
[textView replaceCharactersInRange: NSMakeRange(0,0) withRTF:
[NSData
dataWithBytes: [rtfText UTF8String] length: [rtfText length]]];
The file I write is properly formatted RTF and opens in Text Edit as
desired. The Text View, however, is filled with gibberish (properly
formatted gibberish for the most part, but gibberish). Is this a
problem
with text encoding? Should I be using something other than
UTF8String?
Would something like this work?
[textView replaceCharactersInRange: NSMakeRange(0,0) withRTF:
[rtfText dataUsingEncoding: NSUTF8StringEncoding]];
What is the native encoding for RTF data? If the specification
dictates some particular encoding, use that!
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden