How can i encode french Character?
let's say i have String strMEssage='Pour se désinscrire du service ';
String utf8 = new String(strMessage.getBytes("ISO8859_15"),"ISO8859_15");
o/P is not proper for special char ? is coming
How can i encode french Character?
let's say i have String strMEssage='Pour se désinscrire du service ';
String utf8 = new String(strMessage.getBytes("ISO8859_15"),"ISO8859_15");
o/P is not proper for special char ? is coming
You seem to be mixing a lot of concepts here.
A String
is a sequence of char
s. The fact that internally Java uses UTF-16 is irrelevant.
You never send Java String
s as is, nor receive a Java String
, nor write String
s directly in a file, not read String
s directly from a file. You send/receive bytes. And turning bytes into characters and the reverse is made by a Charset{Decoder,Encoder}
.
In Java source files, just write the string as you want it. When you send/write/receive/read it, use the correct encoding. That is all there is to it.
See Charset
for generic information.
And if you use a Reader
or Writer
, always specify the encoding.