title: org.apache.commons.codec.DecoderException: Odd number of characters
body: <p>Sending hex string in url parameter and trying to convert it in to string at server side.
  Converting user input string by using following javascript encoding code</p>
  <pre class="lang-js prettyprint-override"><code>function encode(string) {
      var number = &quot;&quot;;
      var length = string.trim().length;
      string = string.trim();
      for (var i = 0; i &lt; length; i++) {
          number += string.charCodeAt(i).toString(16);
      }
      return number;
  }
  </code></pre>
  <p>Now I'm trying to parse hex string <code>419</code> for russian character <code>Й</code> in java code as follows</p>
  <pre class="lang-java prettyprint-override"><code>byte[] bytes = &quot;&quot;.getBytes();
       
  try {
      bytes = Hex.decodeHex(hex.toCharArray());
      sb.append(new String(bytes,&quot;UTF-8&quot;));
  } catch (DecoderException e) {      
      e.printStackTrace(); // Here it gives error 'Odd number of characters'
  } catch (UnsupportedEncodingException e) {           
      e.printStackTrace();
  }
  </code></pre>
  <p>but it gives following error</p>
  <pre><code>&quot;org.apache.commons.codec.DecoderException: Odd number of characters.&quot; 
  </code></pre>
  <p>How it can be resolved. As there are many russian character have hex code 3 digit and due to this it is not able to convert it to <code>.toCharArray()</code>.</p>