Hello everyone, I tried working with unicode data yesterday.
Basically Japanese Characters. Pure not in the notation of \0xxxx something or other.
I cannot seem to work it out property.. anyone has any ideas on how to solve this? thanks.
Printable View
Hello everyone, I tried working with unicode data yesterday.
Basically Japanese Characters. Pure not in the notation of \0xxxx something or other.
I cannot seem to work it out property.. anyone has any ideas on how to solve this? thanks.
The InputStreamReader class can be used to convert a byte stream to a character stream and it's analogue. OutputStreamWriter can be used to convert a character stream to a byte stream. Both of which enable you to set the encoding when they are created.
Code:FileInputStream fis = new FileInputStream("test.txt");
InputStreamReader isr = new InputStreamReader(fis, "sjis");
I tried that then data comes from the standard console... even tried a literal string... still it comes out garbage. :s
Just for clarification. The input to be transformed is comming from the standard console?
Quote:
Originally Posted by Dillinger4
yeah... using buffered stream readers. etc etc. even files :s
sorry i fogot the bring my code for it. :s
but i tried it on a literal string also. to no avail.
Code:byte [] sjisbytes = "マリベル".getBytes("SJIS");
and a couple of more variations
did i use that correctly. :s
I found the following response to a question posed in the Java forums.
http://forum.java.sun.com/thread.jsp...sageID=2758382
Quote:
ii) You mention a JVM default encoding alot. I presume
> this is a system.property. which one ?
No idea. You would have to dig into the VM source to figure it out. You can change it on the command line though. Presumably on windows it is tied to the language that you set when you initially install windows.
Maybe changing the Local might work.
Code:import java.util.Locale;
Locale(String language)
Locale(String language, String country)
Locale(String language, String country, String variant)
Is your standard console even capable of displaying Japanese?
yes it is. it displays error messages in japanese. :s
What happens when you directly write some Japanese characters to the console using System.out.println() ?
it displays square characters.