Garbled String Problem

Discussion in 'Software' started by vknight, Sep 28, 2010.

  1. vknight

    vknight

    Joined:
    Sep 28, 2010
    Messages:
    2
    Hello,

    I have an application that uses TMF814 IDL and JacORB.
    The application works fine until I tested to input using japanese characters.
    The japanese characters seems to be garbled when it reaches the client.

    Sample:
    Client ---> server.getMessage();
    Server
    ------
    string getMessage()
    {
    return こんにちわ;
    }
    -----
    Client Output: r?Lj

    I searched the web for similar problems, their suggestion was to change the idl implementation from string to wstring. They said that its because java string is 2 bytes and idl string is 1 byte.
    I tried to create a simple application to test their suggestion but the problem is I cannot change the idl because its a standard idl from TMF814. So i need a workaround so that the string can be viewed in the client with its current format preserved.

    Can anyone help me on this?

    There was also a similar post i found and the solution was to use ISO-8859-1 encoding and to convert the string from C++ string to idl string using UJTOSJ/
    SJTOUJ. What is the equivalent function of UJTOSJ in Java?

    Btw, my application is in Java and is using UTF-8 encoding.

    Thanks,
    Vergil
     
    vknight, Sep 28, 2010
    #1
    1. Advertising

  2. vknight

    wwonka

    Joined:
    Sep 30, 2010
    Messages:
    3
    I have no idea what TMF814 IDL and JacORB technologies are, but suffice it to say you need UTF-8 (2-bytes per character) all the way from your Java code through to the client so the text doesn't get garbled. If you convert to 1-byte per character strings then you're screwed because 1 byte is generally only for ASCII characters.

    ASCII only goes up to 255 which means you can only display 255 characters. Look up ASCII charts online to see which 255 these are. You're going to have problems with copyright symbols and registered trademarks and many other languages besides japanese unless you can use the proper string encoding all the way through your application.

    Hope this is of some help.
     
    wwonka, Sep 30, 2010
    #2
    1. Advertising

  3. vknight

    vknight

    Joined:
    Sep 28, 2010
    Messages:
    2
    Thank for the reply.

    Yes I see that the problem is what encoding to use or what string manipulation is needed so that the data would not be garbled. Do you know any technique?
     
    vknight, Oct 5, 2010
    #3
    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. =?Utf-8?B?VGhlYQ==?=

    Garbled Display after SP2 Installed - Please help!!

    =?Utf-8?B?VGhlYQ==?=, Apr 19, 2005, in forum: Microsoft Certification
    Replies:
    3
    Views:
    572
    Jarrette Smith
    May 2, 2005
  2. gururin
    Replies:
    3
    Views:
    832
  3. Terry

    garbled junk

    Terry, Apr 23, 2005, in forum: Computer Support
    Replies:
    8
    Views:
    673
    old john
    Apr 23, 2005
  4. lbbss
    Replies:
    4
    Views:
    2,373
  5. newasp.net
    Replies:
    1
    Views:
    1,669
    imransyed63
    Aug 21, 2008
Loading...

Share This Page