Java UTF from toUTF8(String str)

Here you can find the source of toUTF8(String str)

Description

to UTF

License

Apache License

Declaration

public static String toUTF8(String str) 

Method Source Code

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

public class Main {

    public static String toUTF8(String str) {
        if (str != null && !str.equals("")) {
            try {
                return new String(str.getBytes("ISO8859-1"), "UTF-8");
            } catch (Exception var2) {
                var2.printStackTrace();
                return "";
            }/*from  w w w.j  av  a2  s  .  c  om*/
        } else {
            return "";
        }
    }

    public static boolean equals(String str1, String str2) {
        return str1 != null && !str1.equals("") && str2 != null && !str2.equals("") ? str1.equals(str2) : false;
    }
}

Related

  1. toUtf8(String hex)
  2. toUTF8(String oldStr)
  3. toUtf8(String s)
  4. toUTF8(String s)
  5. toUTF8(String s, String encoding)
  6. toUTF8(String string)
  7. toUtf8(String texto)
  8. toUTF8ByteArray(String s)
  9. toUtf8ByteArray(String source)