escape U+2028 in JSON responses

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@950125 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2010-06-01 15:47:03 +00:00
parent a9eb9c50a4
commit 8d8c162dc5
2 changed files with 5 additions and 1 deletions

View File

@ -318,6 +318,9 @@ Bug Fixes
* SOLR-1928: TermsComponent didn't correctly break ties for non-text
fields sorted by count. (yonik)
* SOLR-1936: The JSON response format needed to escape unicode code point
U+2028 - 'LINE SEPARATOR' (Robert Hofstra, yonik)
Other Changes
----------------------

View File

@ -613,7 +613,7 @@ class JSONWriter extends TextResponseWriter {
for (int i=0; i<val.length(); i++) {
char ch = val.charAt(i);
if ((ch > '#' && ch != '\\') || ch==' ') { // fast path
if ((ch > '#' && ch != '\\' && ch != '\u2028') || ch==' ') { // fast path
writer.write(ch);
continue;
}
@ -628,6 +628,7 @@ class JSONWriter extends TextResponseWriter {
case '\t': writer.write('\\'); writer.write('t'); break;
case '\b': writer.write('\\'); writer.write('b'); break;
case '\f': writer.write('\\'); writer.write('f'); break;
case '\u2028': unicodeEscape(writer,ch); break;
// case '/':
default: {
if (ch <= 0x1F) {