如何在 java 中将字符串转换为 CCSID 37

How to convert a string to CCSID 37 in java

我想将 java 字符串转换为 "HelloWorld" 数字 CCSID 37 数字。但是我在 java 中找不到任何 API 来执行此操作。

CCSID37

你可以这样试试:

String.getBytes(System.getProperty("com.ibm.cics.jvmserver.local.ccsid"))
String(bytes, System.getProperty("com.ibm.cics.jvmserver.local.ccsid"))

参考Data encoding from IBM了解详情

The JCICS API uses the code page that is specified in the CICS region and not the underlying JVM. So if the JVM uses a different file encoding, your application must handle different code pages. To help you determine which code page CICS is using, CICS provides several Java properties:

  • The com.ibm.cics.jvmserver.supplied.ccsid property returns the code page that is specified for the CICS region. By default, the JCICS API uses this code page for its character encoding. However, this value
    can be overridden in the JVM server configuration.
  • The com.ibm.cics.jvmserver.override.ccsid property returns the value of an override in the JVM profile. The value is a code page that the JCICS API uses for its character encoding, instead of the code page that is used by the CICS region.
  • The com.ibm.cics.jvmserver.local.ccsid property returns the code page that the JCICS API is using for character encoding in the JVM server.