question: void normalize ( ) throws IOException { int end = chars . length ( ) ; if ( end == 0 ) { return ; } int pos = 0 ; int codepoint = Character . codePointAt ( chars , 0 ) ; boolean escaped = false ; for ( int i = 0 ; i < end ; ) { int charCount = Character . charCount ( codepoint ) ; int i2 = i + charCount ; int nextCodepoint = i2 < end ? Character . codePointAt ( chars , i2 ) : - 1 ; if ( escaped ) { escaped = false ; if ( escapeOneCodepoint ( pos , i - 1 , codepoint , nextCodepoint ) ) { pos = i2 ; } } else if ( codepoint == '\\' ) { escaped = true ; } else if ( escapeOneCodepoint ( pos , i , codepoint , nextCodepoint ) ) { pos = i2 ; } i = i2 ; codepoint = nextCodepoint ; } out . append ( chars , pos , end ) ; }
target:  Like escape, but treats the input as an already escaped string and only tries to ensure that characters that might or need not be escaped for correctness are consistently escaped.