Hello,
I want to execute a shell script with parameters from a Java class. I have problems though with the encoding of the parameters which have some special characters (umlauts, accents). My java program is ran with "-Dfile.encoding=ISO-8859-1" but the variables need to be passed in UTF-8 encoding to the script. Here is a short example:
public static void main(String... aArguments) {
try {
String[] cmd = new String[2];
cmd[0] = "/media/nfs/test.sh";
cmd[1] = "Müüler";
Process p = Runtime.getRuntime().exec(cmd, null, null);
int ret = p.waitFor();
}
catch (Exception e) {
e.printStackTrace();
}
}
If I run the program with
java -Dfile.encoding=ISO-8859-1 MyTest
The test.sh script will get weird characters. So how can I say that I need the "cmd" being encoded in UTF-8 ?
Thanks,
Tex