diff --git a/build.xml b/build.xml index 2949a685..d607d2f5 100644 --- a/build.xml +++ b/build.xml @@ -125,8 +125,8 @@ - - + + diff --git a/lib/icu4j.jar b/lib/icu4j.jar index abb0babb..a427d6be 100644 Binary files a/lib/icu4j.jar and b/lib/icu4j.jar differ diff --git a/source/net/sourceforge/filebot/format/ExpressionFormat.lib.groovy b/source/net/sourceforge/filebot/format/ExpressionFormat.lib.groovy index b91022a2..9b1abb03 100644 --- a/source/net/sourceforge/filebot/format/ExpressionFormat.lib.groovy +++ b/source/net/sourceforge/filebot/format/ExpressionFormat.lib.groovy @@ -117,3 +117,11 @@ String.metaClass.replacePart = { replacement = "" -> // no pattern matches, nothing to replace 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}]", "?") }