Merge pull request #1698 from OpenRefine/issue1681

Fix unescape GREL function in javascript mode.
This commit is contained in:
Jacky 2018-08-29 21:24:52 -04:00 committed by GitHub
commit 21712db6e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -62,7 +62,7 @@ public class Unescape implements Function {
} else if ("csv".equals(mode)) {
return StringEscapeUtils.unescapeCsv(s);
} else if ("javascript".equals(mode)) {
return StringEscapeUtils.escapeEcmaScript(s);
return StringEscapeUtils.unescapeEcmaScript(s);
} else if ("url".equals(mode)) {
try {
return URLDecoder.decode(s,"UTF-8");

View File

@ -177,4 +177,10 @@ public class ToFromConversionTests extends RefineTest {
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"),"Ä");
}
}