[opencms-dev] Problems with special characters

Joe Desbonnet jdesbonnet at gmail.com
Mon Sep 5 12:11:43 CEST 2005


This is a common problem: you must understand the difference between UTF-8 
and ISO-8859-1 character encoding. Put very simply: UTF-8 is much better for 
international use because it encodes most characters in use today (including 
Japanese etc), however it can take more than one byte to encode a character. 
ISO-8859-1 on the other hand uses only one byte per character but is only 
suitable for English and Western European languages.

A common mistake is to encode a string with UTF-8 and to decode it as 
ISO-8859-1. Many non-ASCII characters will appear garbled (just like in your 
example) because more than one byte was used to encode them.

So you must be mindful of what encoding mechanism was used to encode your 
string and to use the same system to decode. 

You can specify the character encoding you want to use in the HTML of your 
form or in the HTTP headers. You will need to Google a bit for the terms 
"Character Encoding", "UTF-8", "ISO-8859-1", "HTML" etc.

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/6f8bc6cc/attachment.htm>


More information about the opencms-dev mailing list