Notes on Reference Citations - Version 2.70, by Dr. Herong Yang
UTF Encoding in java
'Building Chinese Web Sites using PHP' tutorial book was cited in an forum post in 2009.
The Building Chinese Web Sites using PHP tutorial book was cited in an forum post in 2009.
Subject: UTF Encoding in java Date: Jul 1, 2009 Author: tafanderson Source: http://stackoverflow.com/questions/1067266 /utf-encoding-in-java >I need to encode a message from request and write it into a file. >Currently I am using the URLEncoder.encode() method for encoding. But >it is not giving the expected result for special characters in French >and Dutch. > >I have tried using URLEncoder.encode("msg", "UTF-8") also. > >Example: >Original message: Pour gérer votre GSM >After encoding: Pour g?rer votre GSM > >Can any one tell me which method I can use for this purpose? ... There are a lot of causes for the problem you have observed. The primary cause is that REQUEST is not giving you UTF-8 in the first place. I imagine that this situation will change over time, but currently there are many weak links that could be to blame: neither mySQL nor PHP5, html nor browsers use UTF-8 by default, though the data may originally be. See stackoverflow: how-do-i-set-character-encoding-to-utf-8-for- default-html and java.sun.com: technicalArticles--HTTPCharset I experienced this problem with Chinese, and for that I'd recommend http://www.herongyang.com/PHP-Chinese/
Table of Contents