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