Overview
Comment: | Don't fall back to ISO-8859-1 in +[OFString stringWithContentsOfURL:]. This way, we can be sure to never have garbage. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c74d7dec0e05e5b97c01739050e3c63f |
User & Date: | js on 2011-04-25 22:50:56 |
Other Links: | manifest | tags |
Context
2011-04-25
| ||
22:54 | Actually, it's called charset in the header, not encoding. check-in: 7d29241068 user: js tags: trunk | |
22:50 |
Don't fall back to ISO-8859-1 in +[OFString stringWithContentsOfURL:]. This way, we can be sure to never have garbage. check-in: c74d7dec0e user: js tags: trunk | |
22:48 | Add +[OFXMLElement elementWithElement:]. check-in: 34788afdca user: js tags: trunk | |
Changes
Modified src/OFString.h from [fdc7cb8d4c] to [bd128c526e].
︙ | ︙ | |||
152 153 154 155 156 157 158 | /** * Creates a new OFString with the contents of the specified URL. * * If the URL's scheme is file, it tries UTF-8 encoding. * * If the URL's scheme is http(s), it tries to detect the encoding from the HTTP * headers. If it could not detect the encoding using the HTTP headers, it tries | | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | /** * Creates a new OFString with the contents of the specified URL. * * If the URL's scheme is file, it tries UTF-8 encoding. * * If the URL's scheme is http(s), it tries to detect the encoding from the HTTP * headers. If it could not detect the encoding using the HTTP headers, it tries * UTF-8. * * \param URL The URL to the contents for the string * \return A new autoreleased OFString */ + stringWithContentsOfURL: (OFURL*)URL; /** |
︙ | ︙ | |||
289 290 291 292 293 294 295 | * Initializes an already allocated OFString with the contents of the specified * URL. * * If the URL's scheme is file, it tries UTF-8 encoding. * * If the URL's scheme is http(s), it tries to detect the encoding from the HTTP * headers. If it could not detect the encoding using the HTTP headers, it tries | | | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | * Initializes an already allocated OFString with the contents of the specified * URL. * * If the URL's scheme is file, it tries UTF-8 encoding. * * If the URL's scheme is http(s), it tries to detect the encoding from the HTTP * headers. If it could not detect the encoding using the HTTP headers, it tries * UTF-8. * * \param URL The URL to the contents for the string * \return An initialized OFString */ - initWithContentsOfURL: (OFURL*)URL; /** |
︙ | ︙ |
Modified src/OFString.m from [e4ea0d48b5] to [1d7ba884bb].
︙ | ︙ | |||
747 748 749 750 751 752 753 | encoding = OF_STRING_ENCODING_ISO_8859_1; if ([contentType hasSuffix: @"encoding=iso-8859-15"]) encoding = OF_STRING_ENCODING_ISO_8859_15; if ([contentType hasSuffix: @"encoding=windows-1252"]) encoding = OF_STRING_ENCODING_WINDOWS_1252; } | | < < < | < < < < < < | < | | | < | 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 | encoding = OF_STRING_ENCODING_ISO_8859_1; if ([contentType hasSuffix: @"encoding=iso-8859-15"]) encoding = OF_STRING_ENCODING_ISO_8859_15; if ([contentType hasSuffix: @"encoding=windows-1252"]) encoding = OF_STRING_ENCODING_WINDOWS_1252; } if (encoding == OF_STRING_ENCODING_AUTODETECT) encoding = OF_STRING_ENCODING_UTF_8; self = [[c alloc] initWithCString: (char*)[[result data] cArray] encoding: encoding length: [[result data] count]]; [pool release]; return self; } - (const char*)cString { |
︙ | ︙ |