I want to ask an question about the objective C. What is "content-type"
in the NSMutableURLRequest
? Is it related to the header field as I see the forHTTPHeaderField
?
Also, what is the different between the following statement?
// statement 1
[req开发者_开发知识库uest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
// statement 2
[request setValue:@"text/html; charset=UTF-8" forHTTPHeaderField:@"Content-Type"];
Thank you very much.
Content-type
is known as a MIME type that indicates what kind of data an HTTP response contains.
Here is more information about MIME types and some examples: http://en.wikipedia.org/wiki/MIME
For a full list of official MIME types approved by the IANA, take a look here: http://www.iana.org/assignments/media-types/
To answer your other question:
Statement 1 is a MIME type for a response to a web form that has been filled in.
Statement 2 is the MIME type for a standard HTML page which has a characterset of UTF-8 (basically, international support versus standard ASCII or something else).
精彩评论