deepa

deepa

  • NA
  • 42
  • 0

Converting string data(which contains EBCDIC, Packed decimal and Endian data) to byte array

Aug 24 2009 4:54 AM
Hi,
I need to convert string which has EBCDIC, packed decimal and Endian data to byteArray to save it in the database. I tried the following code.

Byte[] updateByte;
updateByte = System.Text.Encoding.Default.GetBytes(strData);
//here, strData is the string

Here what happens is it converts some characters to '?' with decimal value 63. For e.g. abc(ASCII vale) after converting to EBCDIC i get [129 130 131](these are decimal values of the converted EBCDIC data). When i convert the string to byte array in order to save it in database, it changes all three characters(129, 130 and 131) to 63. This mostly happens with small case alpbhbets.

I also tried other encoding(EBCDIC-US) but this also changes more characters.

IMP: Please note that the string that i need to convert to byte array contains EBCDIC, Packed decimal and Also Endian data.

Kindly let me know how i can achieve this.

Thanks,
Deepa