base64 decoding a string containing emoji in java

By lostdong12

I am base64 decoding string, which has emojis, in Spring MVC back end with the following code.

    byte[] decoded = Base64.getDecoder().decode(base64EncodedStr);
    try {
        strToSave = new String(decoded, "UTF-8");
    } catch (UnsupportedEncodingException e) {

After saving the decoded string into MongoDB, most the decoded emojis are �s, which is the replacement character. What went wrong here?

Source: Stack Overflow


Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273