Toggle navigation
Toggle navigation
This project
Loading...
Sign in
iOS
/
asi-http-request
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Roman Busyghin
2009-02-26 00:56:04 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
Ben Copsey
2009-02-25 22:42:23 +0000
Commit
68959bd141dd4141a0b6380268c3db674f4eb993
68959bd1
1 parent
90999ca5
Encoding detection logic was fixed
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
ASIHTTPRequest.m
ASIHTTPRequest.m
View file @
68959bd
...
...
@@ -769,8 +769,17 @@ static NSError *ASIUnableToCreateRequestError;
NSString
*
contentType
=
[[
self
responseHeaders
]
objectForKey
:
@"Content-Type"
];
NSStringEncoding
encoding
=
[
self
defaultResponseEncoding
];
if
(
contentType
)
{
NSArray
*
parts
=
[
contentType
componentsSeparatedByString
:
@"="
];
NSString
*
IANAEncoding
=
[
parts
objectAtIndex
:[
parts
count
]
-
1
];
NSString
*
charsetSeparator
=
@"charset="
;
NSScanner
*
charsetScanner
=
[
NSScanner
scannerWithString
:
contentType
];
NSString
*
IANAEncoding
=
nil
;
if
([
charsetScanner
scanUpToString
:
charsetSeparator
intoString
:
NULL
])
{
[
charsetScanner
setScanLocation
:
[
charsetScanner
scanLocation
]
+
[
charsetSeparator
length
]];
[
charsetScanner
scanUpToString
:
@";"
intoString
:
&
IANAEncoding
];
}
if
(
IANAEncoding
)
{
CFStringEncoding
cfEncoding
=
CFStringConvertIANACharSetNameToEncoding
((
CFStringRef
)
IANAEncoding
);
if
(
cfEncoding
!=
kCFStringEncodingInvalidId
)
{
...
...
Please
register
or
login
to post a comment