【问题标题】:How to change HEX value to EBCDIC char如何将 HEX 值更改为 EBCDIC 字符
【发布时间】:2011-02-21 05:51:58
【问题描述】:

在 Java 中将 HEX 值转换为 ebcdic char 类型的最简单方法是什么

例如下面的示例将在符号处返回,但我想获得等效的 ebcidic,即空格字符..

字符串十六进制 = "40"; char c = (char) Integer.parseInt(hex, 16);

【问题讨论】:

标签: java hex converter ebcdic


【解决方案1】:

简单且最有效的解决方案可能是自己编写一个查找表,例如基于http://www.natural-innovations.com/computing/asciiebcdic.html

其他解决方案可以找到here

【讨论】:

    【解决方案2】:

    将十六进制字符转换为 ebcdic(例如:C1

    byte b[] = {(byte) Integer.parseInt("C1", 16)};
    System.out.print(new String(b, "Cp037"));
    

    结果将是A

    【讨论】:

    • 这将0x60 转换为-0x6D 转换为_,尽管在某些网站上情况正好相反。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-17
    • 1970-01-01
    • 1970-01-01
    • 2020-11-13
    • 2018-03-20
    • 1970-01-01
    相关资源
    最近更新 更多