有些脚本无法在 JPanel 中正确显示,即使以 UTF-8 编码也是如此?

Some scripts don't display correctly in JPanel, even when encoded in UTF-8?

所以我只是为自己制作这个 Java 小应用程序,它旨在处理不同的语言(虽然我还不知道是哪种语言),这意味着它应该能够处理不同的脚本。问题是某些脚本(例如缅甸语)似乎无法正确显示。下图显示了我的意思: http://i.stack.imgur.com/1WQ52.png

如您所见,大多数脚本似乎都可以正常工作,甚至更晦涩的脚本(例如格鲁吉亚语)和更复杂的脚本(例如中文)。但其他脚本无法正确显示。有办法解决这个问题吗?

有关信息,这是我显示上图的确切过程:

1) 从 .txt 文件中读取(.txt 文件以 UTF-8 编码,所有不同的脚本显示都很好)如下:

try {
    fis = new FileInputStream("text file as path");
} catch (FileNotFoundException e) {
    e.printStackTrace();
}
try {
    br = new BufferedReader(new InputStreamReader(fis,"UTF8"));
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
}
    //more stuff...
try {
    while((lineStr = br.readLine()) != null){
        //Store lineStr in a String[] array...
    }
    br.close()
} catch (IOException e) {
    e.printStackTrace();
}

2) 一旦这些行在 String[] 变量(称为 "linesArray")中,我就在 JPanel 中显示它们:

JLabel[] labels = new JLabel[linesArray.length];
String labeltext = new String();
for(int i=0;i<linesArray.length;i++){                   
    labeltext = String.format("<html><div WIDTH=%d>%s</div><html>", 139, linesArray[i]);
    labels[i] = new JLabel(labeltext);
    labels[i].setForeground(Color.RED);
    //set bounds and add to the JPanel
}

感谢您的帮助!

您使用的字体中似乎没有包含您要显示的字符。