[opencms-dev] Problems with special characters

Joe Desbonnet jdesbonnet at gmail.com
Mon Sep 5 12:34:40 CEST 2005


I forgot to mention in my last email : a quick one-liner to convert a 
parameter what was encoded as UTF-8, but incorrectly interpreted as 
ISO-8859-1 is:
String myParam = new String 
(getParameter("myParam").getBytes("UTF-8"),"ISO-8859-1");

There is some discussion of the problem here:
http://www.jguru.com/faq/view.jsp?EID=1030399

Googling around will get lots more --- it's a very common problem. If you 
deal a lot with internationalization, it's well worth your while learning 
the background to UTF-8, ISO-8859-1 etc. Wikipedia (
http://www.wikepedia.org/ ) is a good starting point. This stuff used to 
drive me nuts until I took the time to sit down and read about it all, and 
then all was clear :-)


Joe.


On 9/5/05, Gonzalez, Arnau (GE Consumer Finance, consultant) <
arnau.gonzalez at ge.com> wrote:
> 
> Hello,
> 
> Passing a text as a parameter from a jsp to another jsp, the special 
> characters change.
> For example, this line (text.jsp just return the text):
> 
> <h1>http://localhost:8080/text.jsp?text=¡hello!</h1>
> 
> shows this: ¡hello!
> 
> I've found that if I use the hex value instead of the char it works, but 
> the problem is that this texts is introduced by the user and is not any 
> practical to obly the user to know the hex codes.
> 
> How can I solve it?
> 
> Arnau
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20050905/2cfc7dcf/attachment.htm>


More information about the opencms-dev mailing list