iPhone – Tomcat does not decode URL encoded string

I am publishing URL-encoded data from my iphone application (encoded using the following method) to a jsp page (Tomcat Behind):

- (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)enc NS_AVAILABLE(10_3, 2_0);

and string encoding as parameters: NSUTF8StringEncoding

But somehow, The data was decoded incorrectly.

Sample Text: ¥£€>€£

Encoded: %C2%A5%C2%A3%E2% 82%AC%3E%E2%82%AC%C2%A3

Received on Cell As SMS: ¥ £ Φ> Φ £

Therefore, it seems that there are very few characters not Is encoded/decoded.

Any ideas, what am I missing?

URI encoding is UTF-8, but Tomcat is decoding them as ISO-8859-1. You need to edit the connector settings in server.xml and add the URIEncoding=”UTF-8″ attribute.

I am downloading from my iphone application (using the following Method encoding) Publish the URL encoded data to the jsp page (Tomcat Behind):

- (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)enc NS_AVAILABLE(10_3, 2_0) ;

Use string encoding as a parameter: NSUTF8StringEncoding

But somehow, the data is decoded incorrectly.

Sample Text : ¥£€>€£

Encoded: %C2%A5%C2%A3%E2%82%AC%3E%E2%82%AC%C2%A3

Received on Cell As SMS: ¥ £ Φ> Φ £

Therefore, it seems that very few characters are not encoded/decoded.

Any ideas, what am I missing?

The URI encoding is UTF-8, but Tomcat is decoding them as ISO-8859-1. You need to edit server.xml In the connector settings and add the URIEncoding = “UTF-8” attribute.

Leave a Comment

Your email address will not be published.