Overview
| Artifact ID: | 3aadbf11f805a4d4fdffaf7e4cd0a17dc27698c7 |
|---|---|
| Ticket: | 839289ffffffffffffffffffffffffffffffffff
http ignores charset in meta tags |
| User & Date: | dkf on 2003-11-12 01:30:45 |
Changes
- icomment:
Logged In: YES user_id=79902 ISO8859-1 is a single byte encoding that gives a meaning to every byte, so you've not lost any information *provided* you can figure out how to un-mess-up the encodings (there is a bijective - and hence invertible - mapping between incoming bytes and characters in the string you get out of the [http::data].) The first thing to do is to go from the UTF-8 rep of the 8859-1-encoded data so you end up with a byte-sequence again. Once you've done that, you can then convert from the byte sequence to the real encoding. This should work fine for most encodings which map the printable ASCII subset in similar ways to 8859-1 (i.e. so that you can work out what the <META> tag says!) but there are outliers (EBCDIC), but in that case you've got an intractable problem that should probably be reported to the maintainer of the website... IMHO, putting encoding info inside a <META> tag is broken by design anyway since there's no way to bound the amount of arbitrarily-encoded information read from the HTTP connection before the encoding switch happens. XML does a more sensible job of this bit at least. (Understanding <META> is a job for an HTML parser, which the HTTP package isn't. You might want to check whether the HTML parser in tcllib does the right thing though...)
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"