This subject has been targeted in many discussions and yet we still see new ones showing up. My scenario is as follows:
A Java framework running on a Linux server where UTF-8 is the default character encoding in the JVM. The framework consists of some services receiving Tibco RV messages to be processed. And some of these messages contains non ASCII characters and are sent from a Windows server and ISO8859-1 is the encoding used when message are created. Now, when the data are extracted from the Tib rv message, the problematic fields "arrives" as Java Objects and needs to be cast to Strings... And here I haven't yet been able to extract ISO8859-1 Strings containing the non ASCII characters (swedish "å","ä","ö") to UTF-8 String in a proper way. I have tried using the following methods:
String isoStreet = new String(response.get("street").toString().getBytes(StandardCharsets.ISO_8859_1),java.nio.charset.StandardCharsets.UTF_8);
and I've also tried using the encoders/decoders within java.nio package with no success.
What's also interesting is that I'm using PuttY to connect to server where services are hosten and running. And from there I have the possibility to make a direct Tibco rv request from the shell (using the tibcorvsend client) and it seems like I need to set the remote character set to ISO8859-1 in PuttY (Window_>Translation) before signing in to server and make that Tib rv request - when this is done those none-ASCII-characters are shown correct in the response, no matter what encoding I set in remote Linux server. Using 'export LC_ALL=en_US.UTF-8' or 'export LC_ALL=sv_SE.iso88591' doesn't matter in this case... only what remote encoding I set in PuttY...
Thsi should imply that the response message seems OK and at least the shell is able to output proper characters. But when inside Java VM (using Java services) I guess the response fields are quietly pushed into Strings when debugging and viewing the response Object (not wanting this conversion to Strings) within Watch view... not sure if you could follow me on this, if not I may try to be more clear if needed...
Any input on this problem, anyone
Regards /R