N
Nirmal R
Hi all,
I am trying to write one java client/server application in Solaris.
I have problem in Client side.
Actually, the client will read the user data using "System.in" and send
the data to user.
It's working fine for user name in english.
The problem comes when I try to read Japanese characters.
the code used to read data is below,
batchReader = new BufferedReader(new
InputStreamReader(System.in));
System.out.print("User : ");
cl = batchReader.readLine();
System.out.println("Line >> " + cl);
for(i = 0; i < cl.length(); i++) {
System.out.print((int) cl.charAt(i));
System.out.print(", ");
}
System.out.println("");
batchReader.close();
for "export LANG=en_US.UTF-8", it reads the data properly,
but for "export LANG=" it prints some junk value.
rnirmal@snds1$ export LANG=en_US.UTF-8
rnirmal@snds1$ java nread
User : ã†ã‡ãŒ.company
Line >> ã†ã‡ãŒ.company
12358, 12359, 12364, 46, 99, 111, 109, 112, 97, 110, 121,
rnirmal@snds1$ export LANG=
rnirmal@snds1$ java nread
User : ã†ã‡ãŒ.company
Line >> ?????????.company
65533, 65533, 65533, 65533, 65533, 65533, 65533, 65533, 65533, 46, 99,
111, 109, 112, 97, 110, 121,
rnirmal@snds1$
I need a common way to read data independent of encoding or "LANG"
value.
Please help me to fix the issue,
really appriciate your help.
Thanks,
Nirmal R.
I am trying to write one java client/server application in Solaris.
I have problem in Client side.
Actually, the client will read the user data using "System.in" and send
the data to user.
It's working fine for user name in english.
The problem comes when I try to read Japanese characters.
the code used to read data is below,
batchReader = new BufferedReader(new
InputStreamReader(System.in));
System.out.print("User : ");
cl = batchReader.readLine();
System.out.println("Line >> " + cl);
for(i = 0; i < cl.length(); i++) {
System.out.print((int) cl.charAt(i));
System.out.print(", ");
}
System.out.println("");
batchReader.close();
for "export LANG=en_US.UTF-8", it reads the data properly,
but for "export LANG=" it prints some junk value.
rnirmal@snds1$ export LANG=en_US.UTF-8
rnirmal@snds1$ java nread
User : ã†ã‡ãŒ.company
Line >> ã†ã‡ãŒ.company
12358, 12359, 12364, 46, 99, 111, 109, 112, 97, 110, 121,
rnirmal@snds1$ export LANG=
rnirmal@snds1$ java nread
User : ã†ã‡ãŒ.company
Line >> ?????????.company
65533, 65533, 65533, 65533, 65533, 65533, 65533, 65533, 65533, 46, 99,
111, 109, 112, 97, 110, 121,
rnirmal@snds1$
I need a common way to read data independent of encoding or "LANG"
value.
Please help me to fix the issue,
really appriciate your help.
Thanks,
Nirmal R.