5 Replies Latest reply on Dec 8, 2008 10:44 AM by Cohenah Ringo

    how to deal with unicode

    Jason Hudgins Newbie

      I wrote a little library that can do simple translations, for example, i can select an operation such as english -> russian. Then if i send my library the string "greetings" it will return to me "??????" (privet) in cyrillic. Since java stores it's strings in unicode, this is all very easy, so long as the result string gets output with something like this :

      PrintStream out = new PrintStream(System.out, true, "UTF-8");
      out.print(results);

      I'm trying to wrap a POJO web service around it, and it works fine with latin chars, but with things like cyrillic, something in the soap stack is mangling up my result string. I don't know what kind of output encoding the xml writer is using, but the string it generates is useless.

      is it possible to tell the soap stack to use UTF-8? I'm not sure what can be done to solve my problem.

        • 1. Re: how to deal with unicode
          Robert Mlekus Newbie

          Actually I think this is a JBossWS (installer) bug ?

          The WSDL and Soap headers default to UTF-8, but the characters sent are in the machines java default encoding!

          I did a "hot fix" to add the system property

           "file.encoding=UTF-8"
          


          to the jvm running JBossWS, thus changing the default file !? encoding
          of the complete jboss installation. Afterwards UTF-8 handling worked
          as expected (before that jbossws 1.2 used the default file encoding of
          the installation (was iso latin 1 on my machine)

          Has anyone found the correct way to configure the file encoding of
          jbossws 1.2?



          • 2. Re: how to deal with unicode
            Jason Hudgins Newbie

            I actually tried that too, but it didn't work for me, here's the jboss process running on my linux box..

            340 pts/0 Sl 1:10 /usr/java/jdk1.5.0_11/bin/java -Dprogram.name=run.sh -server -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dfile.encoding=UTF-8 -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -Djava.endorsed.dirs=/var/www/jboss/lib/endorsed -classpath /var/www/jboss/bin/run.jar:/usr/java/jdk1.5.0_11/lib/tools.jar org.jboss.Main

            Shouldn't there be some way to configure the output encoding for each webservice?

            • 3. Re: how to deal with unicode
              Robert Mlekus Newbie

              Well, it should work then (solved my problems, though).

              Actually make sure that your console will handle UTF-8 correctly, alternatively you might want to direct the output into a file and check it with an editor/hex editor of your choice, or generate a html file to check it with a web-browser. (is much easier than configuring an arbitrary linux console to show utf-8 :-)

              • 4. Re: how to deal with unicode
                Oskar Carlstedt Novice

                Hi!

                It looks like you have a space between the - and D character in -Dfile.encoding...

                //Oskar

                • 5. Re: how to deal with unicode
                  Cohenah Ringo Newbie

                  have you find the solution ? please