Merge pull request #1698 from OpenRefine/issue1681
Fix unescape GREL function in javascript mode.
This commit is contained in:
commit
21712db6e0
@ -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");
|
||||||
|
@ -177,4 +177,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