I want to process input from a unix command i my java application. The problem is that characters such as å, ä and ö come out all wrong. After reading other messages on the mailinglist I suppose input is in MacRoman.
The code:
Process pAllMounted = Runtime.getRuntime().exec("ls /Volumes/");
BufferedReader stdInput = new BufferedReader(new InputStreamReader(pAllMounted.getInputStream(), "MacRoman"));
BufferedReader stdError = new BufferedReader(new InputStreamReader(pAllMounted.getErrorStream(), "MacRoman"));
The result:
The character "å" becomes a\xcc\x8a and the character "ä" becomes o\xcc\x8 and so forth.
I've tried with other character encodings for .getInputStream but so far none has decoded the characters correctly. Now I have to loop through the input and replace all occurences.
Anyone got any suggestions?