title: Strange chars after decoding with java.util.Base64.getDecoder()
body: <p>Im trying to encrypt some user data in the DB then decrepit it back when showing it to users</p>
  
  <p>Im doing this using JPA, Eclipse link 2.7.1, and MYSql 5.6 </p>
  
  <p>the User entity looks like that:</p>
  
  <pre><code>@Entity
  @Cacheable(false)
  @Table(name = "user_table")
  public class User implements Serializable {
  
  // some fields
      @Lob
      @Column(name = "about_me")
      @Convert(converter = EncryptorConverter.class)
      String aboutMe;
  
  // setters and getters
  }
  </code></pre>
  
  <p>and here under is the EncryptorConverter.class</p>
  
  <pre><code>import javax.crypto.Cipher;
  import javax.crypto.spec.IvParameterSpec;
  import javax.crypto.spec.SecretKeySpec;
  
  import org.apache.commons.codec.binary.Base64;
  
  import java.util.*;
  
  @Converter
  
  public class EncryptorConverter implements javax.persistence.AttributeConverter&lt;String, String&gt; {
  
      String key = "************"; // 128 bit key
      String initVector = "**************"; // 16 bytes IV
      IvParameterSpec iv;
      SecretKeySpec skeySpec;
      static Cipher cipher;
      static Cipher deipher;
  
      private static final Logger LOG = Logger.getLogger(
              EncryptorConverter.class.getName());
  
  
      public EncryptorConverter() {
          try {
              iv = new IvParameterSpec(initVector.getBytes("UTF-8"));
              skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
  
              cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
              cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv);
  
              deipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
              deipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
          } catch (Exception ex) {
              LOG.log(Level.SEVERE, ex.getMessage(), ex);
          }
  
      }
  
  
      @Override
      public String convertToDatabaseColumn(String attribute) {
  
          if (attribute == null) {
              return "";
          }
          try {
              byte[] encrypted = cipher.doFinal(attribute.getBytes("UTF-8"));
              return java.util.Base64.getEncoder().encodeToString(encrypted);
          } catch (BadPaddingException e) {
              // do nothing
          } catch (javax.crypto.IllegalBlockSizeException e) {
              // do nothing
          } catch (Exception ex) {
              LOG.log(Level.SEVERE, ex.getMessage(), ex);
          }
  
          return "";
      }
  
      @Override
      public String convertToEntityAttribute(String dbData) {
  
          if (dbData == null) {
              return "";
          }
          try {
              byte[] original = deipher.doFinal(java.util.Base64.getDecoder().decode(dbData.getBytes("UTF-8")));
              return new String(original, "UTF-8");
          } catch (javax.crypto.IllegalBlockSizeException e) {
              // do nothing
          } catch (BadPaddingException e) {
              // do nothing
          } catch (Exception ex) {
              LOG.log(Level.SEVERE, ex.getMessage(), ex);
          }
  
          return "";
      }
  
  }
  </code></pre>
  
  <p>My problem is sometimes when I read the decoded <code>aboutMe</code> field from the <code>user</code> entity it looks like having strange chars like this 
  "��t����a:i3��5�o" and sometimes it'll look just fine without any strange chars.  </p>
  
  <p>Do I do anything wrong with the decoding steps?</p>
  
  <p>I really appreciate your help. </p>