|
-
Sep 12th, 2005, 07:15 PM
#1
Thread Starter
Frenzied Member
Working With Unicode Data [Displaying] etc ... I'm stumped!
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.
-
Sep 13th, 2005, 06:30 PM
#2
Dazed Member
Re: Working With Unicode Data [Displaying] etc ... I'm stumped!
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");
-
Sep 13th, 2005, 07:22 PM
#3
Thread Starter
Frenzied Member
Re: Working With Unicode Data [Displaying] etc ... I'm stumped!
I tried that then data comes from the standard console... even tried a literal string... still it comes out garbage. :s
-
Sep 13th, 2005, 07:51 PM
#4
Dazed Member
Re: Working With Unicode Data [Displaying] etc ... I'm stumped!
Just for clarification. The input to be transformed is comming from the standard console?
-
Sep 13th, 2005, 08:38 PM
#5
Thread Starter
Frenzied Member
Re: Working With Unicode Data [Displaying] etc ... I'm stumped!
 Originally Posted by Dillinger4
Just for clarification. The input to be transformed is comming from the standard console?
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
-
Sep 13th, 2005, 09:52 PM
#6
Dazed Member
Re: Working With Unicode Data [Displaying] etc ... I'm stumped!
I found the following response to a question posed in the Java forums.
http://forum.java.sun.com/thread.jsp...sageID=2758382
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.
-
Sep 13th, 2005, 10:13 PM
#7
Dazed Member
Re: Working With Unicode Data [Displaying] etc ... I'm stumped!
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)
-
Sep 19th, 2005, 09:04 AM
#8
Re: Working With Unicode Data [Displaying] etc ... I'm stumped!
Is your standard console even capable of displaying Japanese?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 19th, 2005, 10:24 PM
#9
Thread Starter
Frenzied Member
Re: Working With Unicode Data [Displaying] etc ... I'm stumped!
yes it is. it displays error messages in japanese. :s
-
Sep 20th, 2005, 05:17 AM
#10
Re: Working With Unicode Data [Displaying] etc ... I'm stumped!
What happens when you directly write some Japanese characters to the console using System.out.println() ?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 22nd, 2005, 12:20 AM
#11
Thread Starter
Frenzied Member
Re: Working With Unicode Data [Displaying] etc ... I'm stumped!
it displays square characters.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|