Changing the encoding of the string
2 posts in topic
Flat View  Flat View

Posted By:   mohamed_zafer
Posted On:   Monday, November 26, 2001 12:13 AM

I have an application that receives a String a parameter, How is it possible that check whether the String is encoded in ISO8859-1, if not I have to transform the String to that encoding,

Any idea..

Mohamed Zafer

Re: Changing the encoding of the string

Posted By:   Thierry_Sourbier  
Posted On:   Saturday, December 1, 2001 12:46 AM

Which encodings are you trying to differentiate? What is the context?

In Java strings are ALWAYS encoded using Unicode. If you don't specify anything the default platform encoding (e.g. cp1252 on Windows) will be used to convert the various i/o streams from/to Unicode.

Given a stream the presence of bytes in the range 80-9F is a good indicator that the stream is not 8859-1 encoded. Those value correspond to control characters that should not appear in text. If you find characters in that range the encoding is likely to be cp1252 which has only 5 invalid codepoints (81,8D,8F,9D,90).

For more information on encodings and find all the tables, you can check the character encoding section of www.i18ngurus.com


Re: Changing the encoding of the string

Posted By:   srinivas_rao  
Posted On:   Wednesday, November 28, 2001 04:42 AM

go throug Java Servlet API and see if
URLEncoder.encode is relevant to this
About | Sitemap | Contact