java - Read Japanese Character using Scanner -
possible duplicate: how can read chinese characters correctly using scanner in java?
my input file name may have japanese characters , trying read file name using scanner.
scanner sc = new scanner(system.in,"utf-8"); system.out.println("encoding :" + charset.defaultcharset()); system.out.println("enter path:"); inputfilepath = sc.nextline();
and if input eg - 漢字
when print file name output
encoding :utf-8 input file path:æ¼¢å—
i tried,
byte[] jis = sc.nextline().getbytes("shift_jis"); system.out.println(new string(jis));
and output was
input file path:??��??�\
how can rectify this?
eclipse
reading console set default utf-8. read info need alter console encoding japanese supported encoding.
in run configuration, alter encoding japanese supported encoding , seek again.
java encoding java.util.scanner
No comments:
Post a Comment