I get response from server in wincp1251 and restkit returns nil to my mapped object strings. I know restKit have a property defaultHTTPEncoding in RKClient(https://github.com/RestKit/RestKit/commit/0ead8a922219ec42ec6dae6ebe59139a1fd589ae), how can I use this and can it helps me?
I'm assuming that your server is returning JSON. If this is the case then the server needs to be updated because it isn't conformant to the JSON spec. Specifically:
Encoding
JSON text SHALL be encoded in Unicode. The default encoding is UTF-8.
An important point to note is that RestKit doesn't unpack the response into a string, because the JSON deserialisation takes a data object (NSJSONSerialization
). And again, the spec states:
The data must be in one of the 5 supported encodings listed in the JSON specification: UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE. The data may or may not have a BOM. The most efficient encoding to use for parsing is UTF-8, so if you have a choice in encoding the data passed to this method, use UTF-8.
So to handle your server response, if you can't change it, you'll need to handle the download yourself, convert the data to the appropriate encoding, unpack the JSON, and then create a mapping operation to use that.