RTEditor/src/main/java/com/onegravity/rteditor/converter/tagsoup/Parser.java
private String expandEntities(String src) {
        int refStart = -1;
        int len = src.length();
        char[] dst = new char[len];
        int dstlen = 0;
        for (int i = 0; i < len; i++) {
            char ch = src.charAt(i);
            dst[dstlen++] = ch;
            if (ch == '&' && refStart == -1) {
                // start of a ref excluding &
                refStart = dstlen;
            } else if (refStart == -1) {
                // not in a ref
            } else if (Character.isLetter(ch) || Character.isDigit(ch)
                    || ch == '#') {
                // valid entity char
            } else if (ch == ';') {
                // properly terminated ref
                int ent = lookupEntity(dst, refStart, dstlen - refStart - 1);
                if (ent > 0xFFFF) {
                    ent -= 0x10000;
                    dst[refStart - 1] = (char) ((ent >> 10) + 0xD800);
                    dst[refStart] = (char) ((ent & 0x3FF) + 0xDC00);
                    dstlen = refStart + 1;
                } else if (ent != 0) {
                    dst[refStart - 1] = (char) ent;
                    dstlen = refStart;
                }
                refStart = -1;
            } else {
                // improperly terminated ref
                refStart = -1;
            }
        }
        return new String(dst, 0, dstlen);
    }
private String expandEntities(String src) {
        int refStart = -1;
        int len = src.length();
        char[] dst = new char[len];
        int dstlen = 0;
        for (int i = 0; i < len; i++) {
            char ch = src.charAt(i);
            dst[dstlen++] = ch;
            if (ch == '&' && refStart == -1) {
                // start of a ref excluding &
                refStart = dstlen;
            } else if (refStart == -1) {
                // not in a ref
            } else if (Character.isLetter(ch) || Character.isDigit(ch)
                    || ch == '#') {
                // valid entity char
            } else if (ch == ';') {
                // properly terminated ref
                int ent = lookupEntity(dst, refStart, dstlen - refStart - 1);
                if (ent > 0xFFFF) {
                    ent -= 0x10000;
                    dst[refStart - 1] = (char) ((ent >> 10) + 0xD800);
                    dst[refStart] = (char) ((ent & 0x3FF) + 0xDC00);
                    dstlen = refStart + 1;
                } else if (ent != 0) {
                    dst[refStart - 1] = (char) ent;
                    dstlen = refStart;
                }
                refStart = -1;
            } else {
                // improperly terminated ref
                refStart = -1;
            }
        }
        return new String(dst, 0, dstlen);
    }
private String expandEntities ( String src ) { int refStart = - 1 ; int len = src . length ( ) ; char [ ] dst = new char [ len ] ; int dstlen = 0 ; for ( int i = 0 ; i < len ; i ++ ) { char ch = src . charAt ( i ) ; dst [ dstlen ++ ] = ch ; if ( ch == ' ' && refStart == - 1 ) { // start of a ref excluding & refStart = dstlen ; } else if ( refStart == - 1 ) { // not in a ref } else if ( Character . isLetter ( ch ) || Character . isDigit ( ch ) || ch == ' ' ) { // valid entity char } else if ( ch == ' ' ) { // properly terminated ref int ent = lookupEntity ( dst , refStart , dstlen - refStart - 1 ) ; if ( ent > 0xFFFF ) { ent -= 0x10000 ; dst [ refStart - 1 ] = ( char ) ( ( ent >> 10 ) + 0xD800 ) ; dst [ refStart ] = ( char ) ( ( ent & 0x3FF ) + 0xDC00 ) ; dstlen = refStart + 1 ; } else if ( ent != 0 ) { dst [ refStart - 1 ] = ( char ) ent ; dstlen = refStart ; } refStart = - 1 ; } else { // improperly terminated ref refStart = - 1 ; } } return new String ( dst , 0 , dstlen ) ; }
with a semicolon.
with a semicolon .