title: Need help in converting EBCDIC to Hexadecimal
body: <p>I am writing an hive UDF to convert the EBCDIC character to Hexadecimal. 
  Ebcdic characters are present in hive table.Currently I am able to convert it, bit it is ignoring few characters while conversion.</p>
  
  <p>Example: </p>
  
  <p>This is the EBCDIC value stored in table:</p>
  
  <blockquote>
    <p>AGNSAÃ±AÂ¦Ã»ÃÃÂÃÂµÂjÂqÂÂÂÂ Â Ã ()</p>
  </blockquote>
  
  <p>Converted hexadecimal:</p>
  
  <blockquote>
    <p>c1c7d5e2000a5cd4f6ef99187d07067203a0200258dd9736009f000000800017112400000000001000084008403c000000000000000080</p>
  </blockquote>
  
  <p>What I want as output:   </p>
  
  <blockquote>
    <p>c1c7d5e200010a5cd4f6ef99187d0706720103a0200258dd9736009f000000800017112400000000001000084008403c000000000000000080</p>
  </blockquote>
  
  <p>It is ignoring to convert the below EBCDIC characters:</p>
  
  <blockquote>
    <p>01 -  It is start of heading<br>
    10 -  It is a escape <br>
    15 -  New line.</p>
  </blockquote>
  
  <p>Below is the code I have tried so far:</p>
  
  <pre><code>public class EbcdicToHex extends UDF {
    public String evaluate(String edata) throws UnsupportedEncodingException {
      byte[] ebcdiResult = getEBCDICRawData(edata);
      String hexResult = getHexData(ebcdiResult);
      return hexResult;
    }   
  
    public byte[] getEBCDICRawData (String edata) throws UnsupportedEncodingException {
      byte[] result = null;
  
      String ebcdic_encoding = "IBM-037"; 
      result = edata.getBytes(ebcdic_encoding);
  
      return result;
    }
  
    public String  getHexData(byte[] result){
      String output = asHex(result);
      return output;
    }
  
    public static String asHex(byte[] buf) {
      char[] HEX_CHARS = "0123456789abcdef".toCharArray();
      char[] chars = new char[2 * buf.length];
      for (int i = 0; i &lt; buf.length; ++i) {
        chars[2 * i] = HEX_CHARS[(buf[i] &amp; 0xF0) &gt;&gt;&gt; 4];
        chars[2 * i + 1] = HEX_CHARS[buf[i] &amp; 0x0F];
      }
      return new String(chars);
    }
  }
  </code></pre>
  
  <p>While converting, its ignoring few EBCDIC characters. How to make them also converted to hexadecimal?</p>