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

Discussion in 'Java' started by Marat, Nov 9, 2004.

  1. Marat

    Marat Guest

    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 ?
     
    Marat, Nov 9, 2004
    #1
    1. Advertising

  2. On 9 Nov 2004 12:56:20 -0800, Marat wrote:

    > The following work arrounds throws exceptions :


    Is that an InsufficientStrawberriesException? No?
    Well perhaps you had better be more precise.
    <http://www.physci.org/codes/javafaq.jsp#exact>

    And, please do not repost your question, especially
    after just 5 minutes.

    --
    Andrew Thompson
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.PhySci.org/ Open-source software suite
    http://www.1point1C.org/ Science & Technology
    http://www.LensEscapes.com/ Images that escape the mundane
     
    Andrew Thompson, Nov 9, 2004
    #2
    1. Advertising

  3. Marat

    Marat Guest

    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 ...




    Andrew Thompson <> wrote in message news:<ajm9vqcn6xxy$>...
    > On 9 Nov 2004 12:56:20 -0800, Marat wrote:
    >
    > > The following work arrounds throws exceptions :

    >
    > Is that an InsufficientStrawberriesException? No?
    > Well perhaps you had better be more precise.
    > <http://www.physci.org/codes/javafaq.jsp#exact>
    >
    > And, please do not repost your question, especially
    > after just 5 minutes.
     
    Marat, Nov 10, 2004
    #3
  4. Re: How to translate Japanese String into UTF-32 encoded using JavaAPIs ?

    Marat wrote:
    > 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?
     
    Michael Borgwardt, Nov 10, 2004
    #4
  5. On 10 Nov 2004 06:33:43 -0800, Marat wrote:

    > Hello Andrew!


    Hello Marat. Please don't top-post, I find it most confusing..
    <http://www.physci.org/codes/javafaq.jsp#netiquette>

    > Andrew Thompson <> wrote in message news:<ajm9vqcn6xxy$>...
    >> On 9 Nov 2004 12:56:20 -0800, Marat wrote:
    >>
    >>> The following work arrounds throws exceptions :

    >>
    >> Is that an InsufficientStrawberriesException? No?
    >> Well perhaps you had better be more precise.
    >> <http://www.physci.org/codes/javafaq.jsp#exact>

    ....
    > 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?

    --
    Andrew Thompson
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.PhySci.org/ Open-source software suite
    http://www.1point1C.org/ Science & Technology
    http://www.LensEscapes.com/ Images that escape the mundane
     
    Andrew Thompson, Nov 10, 2004
    #5
  6. Re: How to translate Japanese String into UTF-32 encoded using JavaAPIs ?

    Andrew Thompson wrote:

    > Is that an InsufficientStrawberriesException?


    Ooh, I _hate_ those! ;-)


    John Bollinger
     
    John C. Bollinger, Nov 10, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    338
    Omar Khan
    Apr 25, 2004
  2. Fritz Bayer
    Replies:
    5
    Views:
    24,304
    Fritz Bayer
    Oct 25, 2004
  3. Marat
    Replies:
    0
    Views:
    454
    Marat
    Nov 9, 2004
  4. Stanley Xu
    Replies:
    2
    Views:
    614
    Stanley Xu
    Mar 23, 2011
  5. Replies:
    5
    Views:
    562
    John W. Kennedy
    Mar 18, 2006
Loading...

Share This Page