WakaJawaka
WakaJawaka

Reputation: 165

Spring web app encoding

I'm currently working on a web application platform being called by other sites using POST forms. Some sites call us using UTF-8, others call us using ISO-8895-1. Since my application is in UTF-8, some of the characters passed by the calling sites appear weird on my side.

Ex: Montréal -> Montr�al

I tried to "convert" the string like this:

new String(request.getParameter("city").getBytes("ISO-8895-1"), "UTF-8");

But i'ts not working, I'm getting "Montr?al"

Is it possible to convert encoding like this?

Is it possible to use different request encoding depending of the calling site?

Upvotes: 4

Views: 80

Answers (1)

RP-
RP-

Reputation: 5837

It seems the encoding type is wrong in your case. ISO-8895-1 should be ISO-8859-1 (8895 -> 8859).

Upvotes: 1

Related Questions