Jump to content

Issue with unicode characters


RaviJ
 Share

Recommended Posts

Hi,

I am passing unicode character from java to autoIt script as :

String filePath = "E:\\ravi\\腿哦哦予以.ppt";
System.out.println(filePath);
String exeFile = "SingleFileUpload.exe";  //autoIt script
dialog =  new String[]{ exeFile,"ie",filePath };
Runtime.getRuntime().exec(dialog);

But when i access filePath parameter from autoIt script, i am getting as ???? instead of correct value of parameter.

MsgBox(0, "File Path:", $CmdLine[2])
ControlSetText($title,"","Edit1", $CmdLine[2])

Getting E:\ravi\????.ppt as value of $CmdLine[2] which is filePath

Thanks,

Ravi

Edited by RaviJ
Link to comment
Share on other sites

Exactly the same issue as yours in a Java bug report: http://bugs.sun.com/view_bug.do?bug_id=4947220

From that page:

Here's the source for the workaround as mentioned by sdaw:

String[] cmd = new String[]{"yourcmd.exe","Japanese CLI argument: \ufeff\u30cb\u30e5\u30fc\u30b9"};     
    Map<String, String> newEnv = new HashMap<String, String>();
    newEnv.putAll(System.getenv());
    String[] i18n = new String[cmd.length + 2];
    i18n[0] = "cmd";
    i18n[1] = "/C";
    i18n[2] = cmd[0];
    for (int counter = 1; counter < cmd.length; counter++)
    {
        String envName = "JENV_" + counter;
        i18n[counter + 2] = "%" + envName + "%";
        newEnv.put(envName, cmd[counter]);
    }
    cmd = i18n;

    ProcessBuilder pb = new ProcessBuilder(cmd);
    Map<String, String> env = pb.environment();
    env.putAll(newEnv);
    final Process p = pb.start();

Edited by Manadar
Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...