Java Script decodeB64_TO_UTF8(String encodedStr)

Here you can find the source of decodeB64_TO_UTF8(String encodedStr)

Description

decode TUTF

License

Open Source License

Declaration

public static String decodeB64_TO_UTF8(String encodedStr) throws UnsupportedEncodingException, ScriptException 

Method Source Code

//package com.java2s;
/**//  www . j a va  2  s.  c  om
* License: https://github.com/votingsystem/votingsystem/wiki/Licencia
*/

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

import java.io.*;

import java.util.Base64;

public class Main {
    public static String decodeB64_TO_UTF8(String encodedStr) throws UnsupportedEncodingException, ScriptException {
        String decodeStr = new String(Base64.getDecoder().decode(encodedStr.getBytes()), "UTF-8");
        ScriptEngineManager factory = new ScriptEngineManager();
        ScriptEngine engine = factory.getEngineByName("JavaScript");
        String result = (String) engine.eval("unescape('" + java.net.URLDecoder.decode(decodeStr, "UTF-8") + "')");
        return result;
    }
}

Related

  1. addAttribute(final ScriptContext context, final String key, final Object value)
  2. adjustKey(String key)
  3. cdInShell(IResource resource)
  4. convert(Object from)
  5. dbObjectFromMap(Map from)
  6. escapeJavascript(String str)
  7. eval(String expression, Object... arguments)
  8. eval(String name, Map params)
  9. eval(String script)