Java UTF8 From getUTF8(String s)

Here you can find the source of getUTF8(String s)

Description

get UTF

License

Apache License

Declaration

public static String getUTF8(String s) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.UnsupportedEncodingException;

public class Main {
    public static String getUTF8(String s) {
        if (s == null || s.equals("")) {
            return "";
        }/*from  w  ww. ja va  2s. co  m*/
        String ss = "";
        try {
            ss = new String(s.getBytes("ISO-8859-1"), "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return ss;
    }
}

Related

  1. getUTF8(byte[] bytes)
  2. getUTF8(String data)
  3. getUTF8(String string)
  4. getUTF8Bytes(String data)
  5. getUTF8Bytes(String s)
  6. getUtf8Bytes(String s)