How to convert a string to CCSID 37 in java

房东的猫 提交于 2019-12-11 12:39:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!