public static boolean isValidTextString(String string) {
        int length = string.length();
        for (int i = 0; i < length; ) {
            int codePoint = string.codePointAt(i);
            if (codePoint < 0x80) {
                if ( ! allowedAsciiChars[codePoint]) return false;
            } else if (codePoint >= Character.MIN_SURROGATE) {
                if ( ! isTextCharAboveMinSurrogate(codePoint)) return false;
                if ( ! Character.isBmpCodePoint(codePoint)) {
                    i++;
                }
            }
            i++;
        }
        return true;
    }
Validates that the given string value only contains text characters.
vespajlib/src/main/java/com/yahoo/text/Text.java