[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
problems with string encoding
From: |
David Wetzel |
Subject: |
problems with string encoding |
Date: |
Tue, 9 Nov 2010 14:21:34 -0800 |
Hi,
when parsing web pages I need to figure out the encoding.
What I am currently doing is, getting the start of the page as string buffer.
look for a substring like "charset=iso-8859-1" and then I have the encoding.
The problem is that if that fails:
encStr = [[NSString alloc] initWithBytes:buffer
length:len
encoding:NSISOLatin1StringEncoding];
I have no means to get the charset string part.
Before, used to use NSASCIIStringEncoding but that fails for some reason.
What to do if its not Latin1? It could be anything.
It would be fine if all non-ASCI-7 chars would be lost.
Is there a nice way of pushing that cString in and get a lossy (and I mean
really lossy) ASCII-7 NSString back?
No Iconv or other conversions are needed.
Comments are welcome :-)
David
- problems with string encoding,
David Wetzel <=