I’m facing an odd behavior. I use the following code to send an HTTP
request to a server using a POST method
[[RKClient sharedClient] post:[NSString stringWithFormat:@"api"]
params:aDict
delegate:self];
The dictionary that hold the values is as followed :
NSDictionary *comment = [NSDictionary dictionaryWithObjects:[NSArray
arrayWithObjects:@"wallcomment", [self.wall
valueForKey:@"wallMessageId"], [self.textView text], nil]
forKeys:
[NSArray arrayWithObjects:@"a01call", @"a01wall_message_id",
@"a01comment", nil]];
When [self.textView text] is filled in with French word with accent
the server receive with wrong encoding : “Test @ vérification
caractères spéciaux”
I do not manipulate the textview text before posting so encoding is also UTF8.
When i check the POST header, the content-type is not having the encoding type. I tried to add it with the following method but it’s not added :
- (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)header
Any special method or property i haven’t seen in the documentation ?
I’m using the RestKit 0.9.3
Do this:
Don’t forget to add other headers if you need any.
One additional thing that I noticed while going through RestKit code, RKObjectManager line 222:
So don’t be surprised you the method is GET, not POST. If you really need POST (which I think you don’t), then change the method in the block.