Menu

#1 Extended escaping in Serializer

open
nobody
None
5
2004-07-16
2004-07-16
No

The standard serializer does not escape german special
charecters, so the method escape(String str)
could/should be changed to

/**
*
* <p>
* Escapes characters from the output.
* </p>
*
* @param str output string
* @return
*/
private String escape(String str) {
str = stringReplace(str, "&", "&amp;");
str = stringReplace(str, "<", "&lt;");
str = stringReplace(str, ">", "&gt;");
str = stringReplace(str, "ä", "&auml;");
str = stringReplace(str, "ö", "&ouml;");
str = stringReplace(str, "ü", "&uuml;");
str = stringReplace(str, "ß", "&szlig;");
str = stringReplace(str, "Ä", "&Auml;");
str = stringReplace(str, "Ü", "&Uuml;");
str = stringReplace(str, "Ö", "&Ouml;");
return str;
}

Discussion