我有以下十进制 ascii 值数组
int[] istr={146,192,128,224,185,152,240,192,6,26,66,72,186,184,88,128,182,40,104,96,36,236,152,128,212,200,64,64,101,252,174,0,96,192,112,24,173,228,200,0,192,128,96,192,144,116,201,48};
我想将这些值作为(ascii / windows-1252)字符写入文件。
HOW IT SHOULD LOOK LIKE: ’À€à¹˜ðÀBHº¸X€¶(h`$였ÔÈ@@eü®
MY OUTPUT: ?À?à¹?ðÀBHº¸X?¶(h`$ì??ÔÈ@@eü®
正如您可以轻松看到的那样,我的输出中有一些字符不会像我期望的那样出现在文件中。编写我的文件的代码:
OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(output),"windows-1252");
try {
for (int c : istr) {
out.write(c);
}
} finally {
out.close();
}
那么为什么某些特殊字符没有正确写入我的文件?