Java UTF from toUTF8(String oldStr)

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

Description

to UTF

License

Open Source License

Declaration

public static final String toUTF8(String oldStr) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {

    public static final String toUTF8(String oldStr) {
        return conversion(oldStr, "utf-8");
    }/*www. j  ava2  s .  c  o  m*/

    private static final String conversion(String oldStr, String coding) {
        String newStr = "";
        try {
            if (oldStr != null) {
                newStr = new String(oldStr.getBytes("ISO-8859-1"), coding);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return newStr;
    }
}

Related

  1. toUTF(String str)
  2. toUTF(String... str)
  3. toUTF8(byte[] outputBuffer, String string, char[] workingBuffer)
  4. toUtf8(final String string)
  5. toUtf8(String hex)
  6. toUtf8(String s)
  7. toUTF8(String s)
  8. toUTF8(String s, String encoding)
  9. toUTF8(String str)