Github user nlivens commented on the pull request:

    https://github.com/apache/cloudstack/pull/1092#issuecomment-158381857
  
    @DaanHoogland, how about the following piece of code then? In this case we 
are using the <code>getPrefferedCharset()</code>
    
    ```java
        public static String encodePasswordUtf8(String originalPassword) {
            byte[] passwordBytes = 
originalPassword.getBytes(StringUtils.getPreferredCharset());
            byte[] encodedPasswordBytes = Base64.encodeBase64(passwordBytes);
            return new String(encodedPasswordBytes, 
StringUtils.getPreferredCharset());
        }
    
        public static String decodePasswordUtf8(String encodedPassword) {
            byte[] encodedPasswordBytes = 
encodedPassword.getBytes(StringUtils.getPreferredCharset());
            byte[] passwordBytes = Base64.decodeBase64(encodedPasswordBytes);
            return new String(passwordBytes, StringUtils.getPreferredCharset());
        }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to