question: static String escapeStringForASCII ( String s ) { StringBuilder out = new StringBuilder ( ) ; char [ ] cArray = s . toCharArray ( ) ; for ( int i = 0 ; i < cArray . length ; i ++ ) { char c = cArray [ i ] ; if ( c > 127 ) { out . append ( "\\U" ) ; String hex = Integer . toHexString ( c ) ; while ( hex . length ( ) < 4 ) hex = "0" + hex ; out . append ( hex ) ; } else if ( c == '\\' ) { out . append ( "\\\\" ) ; } else if ( c == '\"' ) { out . append ( "\\\"" ) ; } else if ( c == '\b' ) { out . append ( "\\b" ) ; } else if ( c == '\n' ) { out . append ( "\\n" ) ; } else if ( c == '\r' ) { out . append ( "\\r" ) ; } else if ( c == '\t' ) { out . append ( "\\t" ) ; } else { out . append ( c ) ; } } return out . toString ( ) ; }
target:  Escapes a string for use in ASCII property lists.