编程语言
首页 > 编程语言> > Java-JTable中的UTF-8

Java-JTable中的UTF-8

作者:互联网

如何将UTF-8字符串添加到JTable中? ASCII范围内的字符串看起来不错,但是带有重音符号的字符无法正确显示.

解决方法:

我在读取字符串时未将阅读器设置为UTF-8编码.
变更后

BufferedReader br = new BufferedReader(new InputStreamReader(di));

BufferedReader br = new BufferedReader(new InputStreamReader(di, "UTF-8"));

文本正确显示.

标签:swing,jtable,java
来源: https://codeday.me/bug/20191208/2094764.html