Java escpos字符集编码 [英] Java escpos charset encoding

查看:127
本文介绍了Java escpos字符集编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须打印原始文本打印机,而我必须设置代码页字符集。我发现最适合我的应用程序的字符集是IBM858。
现在的问题是将字符串编码到此代码页。

i have to print a raw text printer where i have to se the codepage charset. I found that the best charset for my application is the IBM858. Now the problem is to encode the strings to this codepage.

我尝试了此操作:

test = new String("#$@°\\è^ùàòèì\n".getBytes(),"Cp858");
file.write(test.getBytes());

但字符不匹配。

推荐答案

这会将UTF-16字符串编码为Cp858:

This encodes the UTF-16 string as Cp858:

file.write("#$@°\\è^ùàòèì\n".getBytes("Cp858"));

这篇关于Java escpos字符集编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆