开发者

Specifying directory with Japanese characters in build.xml for ant in windows

开发者 https://www.devze.com 2023-04-09 17:44 出处:网络
I have a build.xml file that specify a directory with Japanese characters as an argument to a command.

I have a build.xml file that specify a directory with Japanese characters as an argument to a command.

<exec executable="${amxmlc_cmd}">
        <arg line="${amxmlc_opt}" />
        ...
        <arg line="-source-path+=Work/システム/_config_as" />
        ...
</exec>

Where

<condition property="amxmlc_cmd" value="cmd.exe">
        <os family="windows" />
</condition>
<condition开发者_如何学JAVA property="amxmlc_opt" value='/c "${flex_sdk}bin/amxmlc"'>
        <os family="windows" />
</condition>

I get the error "Error: unable to open 'Work/????/_config_as"

I changed to

<condition property="amxmlc_opt" value='/u/c "${flex_sdk}bin/amxmlc"'>
            <os family="windows" />
</condition>

But I get the same error.

When I changed the windows non-unicode program default to Japanese I got the error "Error: unable to open 'Work/システム/_config_as'"

Any help is greatly appreciated. Thanks for advance.


That is ant, who is not passing properly the Unicode parameters. It will only work if you set the system locale to Japanese and reboot. http://mihai-nita.net/2005/06/11/setting-the-user-and-system-locales/

===

Correction: did some testing, and it is not ant's fault, it is Java itself. I have tried both Runtime.exec and ProcessBuilder.start, and both of them seem to convert the parameters to ANSI before passing it to the child application. (the child app was C, Unicode, and called from a C parent, Unicode, worked fine)

Pretty lame, for 2011 (Java build 1.6.0_26-b03, it would be interesting to try in 7)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号