Java UTF from toUTF8String(String str)

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

Description

removes all bad characters not suitable for UTF-8 encoding

License

Open Source License

Declaration

public static String toUTF8String(String str) 

Method Source Code

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

public class Main {
    /**//from www  . ja v a  2  s  . co  m
     * removes all bad characters not suitable for UTF-8 encoding
     */
    public static String toUTF8String(String str) {
        if (str == null)
            return null;
        return str.replaceAll("([\\ud800-\\udbff\\udc00-\\udfff])", "");
    }
}

Related

  1. toUTF8FromLatin1(byte[] outputBuffer, String string)
  2. toUTF8k(String in)
  3. toUtf8Path(String path)
  4. toUTF8String(byte[] b, int offset, int length)
  5. toUtf8String(String source)
  6. toUTF_8(String s)
  7. toUTFBody(String str)
  8. toUtfBytes(final String s)
  9. toUtfString(char[] encoded)