* support icu4j unicode transliteration in order to allow unicode-to-ascii conversion in format engine
This commit is contained in:
parent
1dbe3b81c7
commit
c766513acf
|
@ -125,7 +125,7 @@
|
||||||
</zipfileset>
|
</zipfileset>
|
||||||
|
|
||||||
<zipfileset src="${dir.lib}/icu4j.jar">
|
<zipfileset src="${dir.lib}/icu4j.jar">
|
||||||
<include name="com/ibm/icu/text/**" />
|
<include name="com/ibm/icu/**" />
|
||||||
</zipfileset>
|
</zipfileset>
|
||||||
|
|
||||||
<zipfileset src="${dir.lib}/sublight-ws.jar">
|
<zipfileset src="${dir.lib}/sublight-ws.jar">
|
||||||
|
|
BIN
lib/icu4j.jar
BIN
lib/icu4j.jar
Binary file not shown.
|
@ -117,3 +117,11 @@ String.metaClass.replacePart = { replacement = "" ->
|
||||||
// no pattern matches, nothing to replace
|
// no pattern matches, nothing to replace
|
||||||
return delegate;
|
return delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert Unicode to ASCII as best as possible. This method will translate umlauts, accents, etc to corresponding ASCII characters.
|
||||||
|
*
|
||||||
|
* e.g. "Österreich" -> "Osterreich"
|
||||||
|
* "カタカナ" -> "katakana"
|
||||||
|
*/
|
||||||
|
String.metaClass.ascii = { com.ibm.icu.text.Transliterator.getInstance("Any-Latin;Latin-ASCII").transform(delegate).replaceAll("[^\\p{ASCII}]", "?") }
|
||||||
|
|
Loading…
Reference in New Issue