How to translate Japanese String into UTF-32 encoded using Java APIs ?

M

Marat

Hello to all!

I have to encode some Japanese string typed in text edit box (all
characters are 3-byte characters) into UTF-32 and store in *.txt file
...

The following work arrounds throws exceptions :

OutputStreamWriter out = new OutputStreamWriter(new
ByteArrayOutputStream(),
"UTF-32");
out.write(value);
out.flush();

String tmp = out.toString();

OR

byte[] bytedValue = value.getBytes("UTF-32");
value = new String(bytedValue,"UTF-32");

Any ideas ?
 
M

Marat

Hello Andrew!

It is really InsufficientOrangeException .. How did you know that ???
I suppose you are farmer with a huge experience in fruit collecting ;-)
So I guess you do not even know what is UnsupportedEncodingException ..

No comments ...

Reposting is caused by timeout session , btw ...
 
M

Michael Borgwardt

Marat said:
It is really InsufficientOrangeException .. How did you know that ???
I suppose you are farmer with a huge experience in fruit collecting ;-)
So I guess you do not even know what is UnsupportedEncodingException ..

The name alone says it all, doesn't it? The encoding UTF-32 is not supported
by your JVM. That's no big surprise since it is not one of the required
encodings and Java doesn't support characters outside of UCS-2 anyway.
Why don't you use UTF-16?
 
A

Andrew Thompson

Hello Andrew!

Hello Marat. Please don't top-post, I find it most confusing..
....
It is really InsufficientOrangeException .. How did you know that ???
I suppose you are farmer with a huge experience in fruit collecting ;-)

No, merely a consumer with a sweet tooth.
So I guess ..

Stop guessing, you're not especially good at it.
..you do not even know what is UnsupportedEncodingException ..

It is an exception caused when you attempt to use an encoding
which is not supported (such as "klingon").

Sun is a bit 'secretive' about the supported encodings, but
a quick search led me here..
<http://java.sun.com/webservices/docs/1.2/tutorial/doc/Encodings.html#wp64107>
and here
<http://java.sun.com/j2se/1.5.0/docs/guide/intl/locale.doc.html#jfc-table>

Hunt around, but as far as I could see, no metnion of UTF-32.
No comments ...
??

Reposting is caused by timeout session

timeout session? That's a new one on me.
.., btw ...

...good, good. No 'sorry about wasting the bandwidth' then?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top