问题
I want to convert a java string say "HelloWorld" to numerical CCSID 37 numbers. But I can't find any API in java to do this.
CCSID37
回答1:
You can try like this:
String.getBytes(System.getProperty("com.ibm.cics.jvmserver.local.ccsid"))
String(bytes, System.getProperty("com.ibm.cics.jvmserver.local.ccsid"))
Refer Data encoding from IBM for details
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.
来源:https://stackoverflow.com/questions/33560726/how-to-convert-a-string-to-ccsid-37-in-java