首页 > 解决方案 > 如何让Java显示画框字符?我得到问号

问题描述

在我的 Win10 CmdPrompt 中,“chcp”命令返回:“活动代码页:437”。我认为 CodePage_437 具有大约 180 个左右的画框字符。我写了一个小程序来显示字符 0-255,但没有得到绘图字符。

public class CodePage_437 { 
/* Display all 256 glyphs in a 16x16 matrix */

public static void displayAllGlyphs() {
    int  c = 0;
    for (    int y = 0;  y < 16;  y++) {
        for (int x = 0;  x < 16;  x++) {        
            System.out.format("%3d",   c  );
            System.out.format("%2c  ", c++);
    }
        System.out.format("\n");
    }
}
public static void main(String[] args) {
    displayAllGlyphs();
    System.out.format("---EOJ---\n");
}

}

我在 Eclipse 2020-12 控制台窗格中获得了与 CmpPrompt 窗口中相同的输出。它看起来像一个编码问题,我一定尝试了 10 种建议的解决方案,但都没有奏效。

标签: encoding

解决方案


推荐阅读