Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Arabic EBCDIC to Cp1256 Conversion

807580Mar 21 2010 — edited Mar 25 2010
scenario:
I'm communicating with CICS mainframe through Messaging Queue(MQ), I receive msg in EBCDIC codepage and I'm trying to convert it to Cp1256,
this message have arabic characters and numbers,

here what i do for converting the EBCDIC message bytes
String var = *new* String(myMessage.readLine().getBytes(),"Cp420");
but when I print this message i found many characters that is not in the original message before the conversion, such as C, B , �
so i looked like its garbage data but its not

so i did the following to remove this characters
StringBuffer tmp = *new* StringBuffer();
*int x = var.length();*
var = var.replace('C', '-');
var = var.replace('�', '-');
var = var.replace('B', '-');
var = var.replace('', '-');
*for*(*int* i=1;i<=var.length();i++){
*if*(var.charAt(x-i) == '-'){
*continue*;
}*else*
tmp.append(var.charAt(x-i));
}
but still have missing and wrong characters, as i use this message to export it as a web service response message,
any idea for successful conversion from EBCDIC to Cp1256 and back from Cp1256 to EBCDIC ??

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 22 2010
Added on Mar 21 2010
9 comments
456 views