开发者

how to handle different language in file/folder path

开发者 https://www.devze.com 2023-03-20 19:18 出处:网络
I have written an application which takes folder path and perform some operation. But if folder path contains charac开发者_C百科ters of language other than English then it is not working. It only supp

I have written an application which takes folder path and perform some operation. But if folder path contains charac开发者_C百科ters of language other than English then it is not working. It only support English characters. How to handle this problem?


Theoretically it should work. Practically in most cases it is a problem of passing parameters from shell to java application. Try to verify that this works correctly: run application from command prompt exactly as you are doing but with remote debugging. Create breakpoint in your code where you are reading the parameter and see what is the value. I believe that the value is corrupted at this phase. This is a typical problem if you are on windows.

In this case you have to configure your system to support unicode characters in command prompt correctly.

If the path is read correctly from command line try to continue debugging and see where it is broken. Check which separator are you using. Avoid using both / and \, use File.separator instead.

0

精彩评论

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

关注公众号