Re: Converting encodingName to NSStringEncoding
Re: Converting encodingName to NSStringEncoding
- Subject: Re: Converting encodingName to NSStringEncoding
- From: Patrick Machielse <email@hidden>
- Date: Sat, 10 Jan 2004 12:12:56 +0100
op 09-01-2004 21:28 schreef j o a r
>
On 2004-01-09, at 13.30, Patrick Machielse wrote:
>
>
> NSString *ename = [response textEncodingName];
>
>
Notice that this might not always return a text encoding, perhaps it
>
even most often will not.
>
>
My suggestion is that you check if it does, and if so use that
>
information, something like what Aki suggested. However, if you don't
>
get a valid encoding this way, you might look at this very, very,
>
convenient method in WebCore to help you detect the proper encoding in
>
a downloaded NSData, and convert it into a NSString:
>
>
NSString *htmlString = [WebCoreEncodings decodeData: htmlData];
It seems that I have to download and build WebCore to get to this object.
Would it still run on 10.2 + Safari?
Also, let me say that I'm not downloading html it's more like a crude
web-service, and, without looking inside the header file, it looks like
decodeData might just try to use the html meta encoding tag?
Primarilly I would like to use the server response and do 'something safe'
if that response is not usable.
Patrick
_______________________________________________
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.