Fix unescape GREL function in javascript mode. Closes #1681.
This commit is contained in:
parent
d271b430ec
commit
87b6aadbad
@ -62,7 +62,7 @@ public class Unescape implements Function {
|
|||||||
} else if ("csv".equals(mode)) {
|
} else if ("csv".equals(mode)) {
|
||||||
return StringEscapeUtils.unescapeCsv(s);
|
return StringEscapeUtils.unescapeCsv(s);
|
||||||
} else if ("javascript".equals(mode)) {
|
} else if ("javascript".equals(mode)) {
|
||||||
return StringEscapeUtils.escapeEcmaScript(s);
|
return StringEscapeUtils.unescapeEcmaScript(s);
|
||||||
} else if ("url".equals(mode)) {
|
} else if ("url".equals(mode)) {
|
||||||
try {
|
try {
|
||||||
return URLDecoder.decode(s,"UTF-8");
|
return URLDecoder.decode(s,"UTF-8");
|
||||||
|
@ -178,4 +178,10 @@ public class ToFromConversionTests extends RefineTest {
|
|||||||
Assert.assertEquals(invoke("escape", Double.parseDouble("1.23"), "javascript"),"1.23");
|
Assert.assertEquals(invoke("escape", Double.parseDouble("1.23"), "javascript"),"1.23");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUnescape() {
|
||||||
|
Assert.assertEquals(invoke("unescape", "Ä", "html"),"Ä");
|
||||||
|
Assert.assertEquals(invoke("unescape", "\\u00C4", "javascript"),"Ä");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user