mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
make specified encoding take precedence over whether the parser is set for http
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37053 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ab6b009343
commit
d7c607cb1d
1 changed files with 17 additions and 3 deletions
|
@ -2919,9 +2919,23 @@ unfold(const unsigned char *src, const unsigned char *end, BOOL *folded)
|
||||||
s = [NSStringClass allocWithZone: NSDefaultMallocZone()];
|
s = [NSStringClass allocWithZone: NSDefaultMallocZone()];
|
||||||
if (1 == flags.isHttp)
|
if (1 == flags.isHttp)
|
||||||
{
|
{
|
||||||
s = [s initWithBytes: beg
|
/* Old web code tends to use latin1 (and RFCs say we
|
||||||
length: src - beg
|
* should use latin1 for headers). However newer systems
|
||||||
encoding: NSISOLatin1StringEncoding];
|
* tend to use utf-8. We default to latin1 (as specified
|
||||||
|
* in the RFCs) unless the encoding has been set to utf-8.
|
||||||
|
*/
|
||||||
|
if (NSUTF8StringEncoding == _defaultEncoding)
|
||||||
|
{
|
||||||
|
s = [s initWithBytes: beg
|
||||||
|
length: src - beg
|
||||||
|
encoding: NSUTF8StringEncoding];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s = [s initWithBytes: beg
|
||||||
|
length: src - beg
|
||||||
|
encoding: NSISOLatin1StringEncoding];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue