Skip to content

Commit

Permalink
Escape using commons-lang3 entity arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian committed Jan 14, 2012
1 parent c81508d commit 627abf9
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -43,7 +43,15 @@ public void escape(StringBuilder output, String input, int start, int offset) {
for (int i = start; i < offset; i++) {
Character c = input.charAt(i);
CharSequence seq = lookupMap.get(c);
output.append((seq == null)? c: seq);
if (seq != null) {
output.append(seq);
} else if (c > 0x7F) {
output.append("&#");
output.append(Integer.toString(c, 10));
output.append(';');
} else {
output.append(c);
}
}
}

Expand Down

0 comments on commit 627abf9

Please sign in to comment.