0

I'm trying to convert a UTF-8 file to EBCDIC IBM284, but java transforms 0A (\n) to 0x15, instead of 0x25 which is the standar our host is using. After searching the Web I found that you can set the option ibm.swaplf to true to change this behavior, but jvm seens to be ignoring it.

System.setProperty("ibm.swaplf", "true");

After transformig I got this output:

INFO  TestParser     : UTF8: €~Ñ}ÇçLF
CRLF

INFO  HexaStrings    : ******** HEX ************************************************
INFO  HexaStrings    : €   Ñ }Ç ç LF CRLF  
INFO  HexaStrings    : e8a7c97c8ca440454400
INFO  HexaStrings    : 22ce31d3737c6a32c6da
INFO  HexaStrings    : ******** FIN HEX ********************************************

INFO  TestParser     : EBCDIC 284: ?½{ÐhHÓÆÃÙÓÆ
INFO  HexaStrings    : ******** HEX ************************************************
INFO  HexaStrings    : ?½ {Ð hHÓ Æ Ã Ù Ó Æ  
INFO  HexaStrings    : 3cb7c964c9c81c8c9c9c801
INFO  HexaStrings    : f2db30883336533393336d5
INFO  HexaStrings    : ******** FIN HEX ********************************************

I'm expecting 0A to be transformed to 25 instead of 15. Any ideas?

Solution: Using IBM1145 instead of IBM284 solved this problem.

JorgeFD
  • 21
  • 5
  • What JDK are you using, Oracle's JDK or IBM's JDK? This is not a property that Oracle's JDK supports. This is probably a feature that is specific to IBM's JDK. – Jesper Mar 05 '14 at 14:36
  • You may be doing this too late. Set it from the command line. – Thorbjørn Ravn Andersen Mar 05 '14 at 14:40
  • I'm using Oracle's JDK. Are there any way of solving this problem using Oracle's JDK? – JorgeFD Mar 05 '14 at 14:49
  • I do not know how to do this with Sun Java. I have seen people writing there own converter's (e.g. https://sourceforge.net/projects/ebcdictoascii/) because of problems with the exiting converters. note: I do not know how good the project is. – Bruce Martin Mar 05 '14 at 23:31

0 Answers0