P
Private
Difference in int cast to char between Windows and redhat linux 9 under JDK
1.4.2_06
With regards to the following; how can I control the charset used for the
cast ? The desired outcome would be for 0x80 to cast to '\u0080'. At
the least I need to be able to run consistently across the two platforms.
Thanks to all for any help on this.
<java code CharTester fragment>
FileInputStream fis=new FileInputStream(args[0]);
for (int i=fis.read();i>-1;i=fis.read())
System.out.print((char)i);
System.out.flush();
fis.close();
</fragment>
<test run under linux>
# hexdump -C < print.doc
00000000 7e 7f 80 81 fc fd ff |~......|
00000007
# java com.asl.hacks.CharTester print.doc
# java com.asl.hacks.CharTester print.doc | hexdump -C
00000000 7e 7f c2 80 c2 81 c3 bc c3 bd c3 bf |~...........|
0000000c
</test>
under windows the same command produces
7e 7f 3f 3f fc fd ff
1.4.2_06
With regards to the following; how can I control the charset used for the
cast ? The desired outcome would be for 0x80 to cast to '\u0080'. At
the least I need to be able to run consistently across the two platforms.
Thanks to all for any help on this.
<java code CharTester fragment>
FileInputStream fis=new FileInputStream(args[0]);
for (int i=fis.read();i>-1;i=fis.read())
System.out.print((char)i);
System.out.flush();
fis.close();
</fragment>
<test run under linux>
# hexdump -C < print.doc
00000000 7e 7f 80 81 fc fd ff |~......|
00000007
# java com.asl.hacks.CharTester print.doc
# java com.asl.hacks.CharTester print.doc | hexdump -C
00000000 7e 7f c2 80 c2 81 c3 bc c3 bd c3 bf |~...........|
0000000c
</test>
under windows the same command produces
7e 7f 3f 3f fc fd ff