UTF-8 to EBCDIC in Java?

Assuming your target system is an IBM mainframe or midrange, it has full support for all of the EBCDIC encodings built into it's JVM as encodings named CPxxxx, corresponding to the IBM CCSID's (CP stands for code-page). You will need to do the translations on the host-side since the client side will not have the necessary encoding support.

Assuming your target system is an IBM mainframe or midrange, it has full support for all of the EBCDIC encodings built into it's JVM as encodings named CPxxxx, corresponding to the IBM CCSID's (CP stands for code-page). You will need to do the translations on the host-side since the client side will not have the necessary encoding support. Since Unicode is DBCS and greater, and supports every known character, you will likely be targeting multiple EBCDIC encodings; so you will likely configure those encodings in some way.

Try to have your client Unicode (UTF-8, UTF-16, etc) only, with the translations being done as data arrives on the host and/or leaves the host system. Other than needing to do translations host-side, the mechanics are the same as any Java translation; e.g. New String(bytes,encoding) and String. GetBytes(encoding), and the various NIO and writer classes.

There's really no magic - it's no different than translating between, say, ISO 8859-x and Unicode, or any other SBCS (or limited DBCS). For example: byte ebcdta="getBytes("CP037"); // get bytes for EBCDIC codepage 37 You can find more information on IBM's documentation website.

EBCDIC has many 8-Bit Codepages. Many of them are supported by the VM. Have a look at Charset.

AvailableCharsets().keySet(), the EBCDIC pages are named IBM... (there are aliases like cp500 for IBM500 as you can see by Charset. ForName("IBM500").aliases()). There are two problems: if you have characters included in different code pages of EBCDIC, this will not help I am not sure, if these charsets are available in any vm outside windows.

For the first, have a look at this approach. For the second, have a try on the desired target runtime ;-).

You can always make use of the IBM Toolbox for Java (JTOpen), specifically the com.ibm. As400.access. AS400Text class in the jt400.jar.It goes as follows: int codePageNumber = 420; String codePage = "CP420"; String sourceUtfText = "Ahmad Yousef Saleh"; AS400Text converter = new AS400Text(sourceUtfText.length(), codePageNumber); byte bytesData = converter.

ToBytes(sourceUtfText); String resultedEbcdicText = new String(bytesData, codePage); I used the code-page 420 and its corresponding java representation of the encoding CP420, this code-page is used for Arabic text, so, you should pick the suitable code-page for Chinese text.

For the midrange AS/400 (IBM I these days) the best bet is to use the IBM Java Toolkit (jt400. Jar) which does all these things transparently (perhaps slightly hinted). Please note that inside Java a character is a 16 bit value, not an UTF-8 (that is an encoding).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions