File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes java command - argument question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "java command - argument question" Watch "java command - argument question" New topic
Author

java command - argument question

hui man
Greenhorn

Joined: Dec 17, 2004
Posts: 3
java classname [arg1] [arg2] ... where argX contains non-english characters

i am now trying to run java command with non-english characters as arguments. the args[] array i get from main() cannot show those characters (it just shows "???"). how can i change the charset of system.in to utf8 before the program gets into main() so that i can get those characters correctly? please give me some suggestions. thanks!
Shrinivas Mujumdar
Ranch Hand

Joined: Aug 27, 2004
Posts: 328
Try to use
Locale class in java.util package
hui man
Greenhorn

Joined: Dec 17, 2004
Posts: 3
Could you please explain a bit more?
public static void main(String[] args) {
System.out.println(args[0]);
...
}
Now, if args[0] is in Chinese, how can I display it correctly using Locale class? Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java command - argument question