mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +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
838608f42e
commit
c111c27363
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()];
|
||||
if (1 == flags.isHttp)
|
||||
{
|
||||
s = [s initWithBytes: beg
|
||||
length: src - beg
|
||||
encoding: NSISOLatin1StringEncoding];
|
||||
/* Old web code tends to use latin1 (and RFCs say we
|
||||
* should use latin1 for headers). However newer systems
|
||||
* 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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue