Hi.
I have a wired problem within my jboss environment.
See the following test coding:
Explanation:
Line-1: The greek character lambda is encoded in the String utf8lambda. The encoding used is explicitly given by parameter. This line of code is not dependend from any encoding properties of the envirorment.
Line-2: Prints out the name of the default character set. This is the character set used for String encoding by default, it comes from envirorment properties. It is set via java runtime parameter "-Dfile.encoding=UTF8".
Line-3: Prints out the bytes of the encoded lambda String. The method String.getBytes() without parameter should use "the plattform's default character set".
Line-4: Prints out the bytes of the encoded lambda String. The method String.getBytes(String charsetName) uses this given character set to decode the string.
The expected output of this would be:
UTF-8
bytes: -50,-69
bytes: -50,-69
Line 3 and 4 result in the same output, because the in both cases the default character set is used for decoding.
I get this output as I run this in a stand-alone java app on my unix server.
But as I run this in the jboss on on the same unix server, I get:
UTF-8
bytes: 63,63
bytes: -50,-69
The method String.getBytes() without parameter seems not to use the default character set, but mayby US-ASCII instead. Why? What can I do make my java behave as expected here?
Background to this problem is, that we are doing some webservice calls via axis, that use utf8 coded string. Special characters are scrambled, e.g. greek characters result in a small square (63). This does always happen, if String.getBytes() uses the wrong encoding. There seems to be a direct relation.
Any hints are welcome - this is very urgent - thanks a lot!
Attached you find the system properties of my environment, get with System.getProperties():