* replace non-ascii chars with space rather than question mark

This commit is contained in:
Reinhard Pointner 2013-05-19 16:34:38 +00:00
parent 5794f65bad
commit 3fefe2ce73
1 changed files with 1 additions and 1 deletions

View File

@ -168,4 +168,4 @@ String.metaClass.transliterate = { transformIdentifier -> com.ibm.icu.text.Trans
* e.g. "Österreich" -> "Osterreich" * e.g. "Österreich" -> "Osterreich"
* "カタカナ" -> "katakana" * "カタカナ" -> "katakana"
*/ */
String.metaClass.ascii = { fallback = '?' -> delegate.transliterate("Any-Latin;Latin-ASCII;[:Diacritic:]remove").replaceAll("[^\\p{ASCII}]", fallback) } String.metaClass.ascii = { fallback = ' ' -> delegate.transliterate("Any-Latin;Latin-ASCII;[:Diacritic:]remove").replaceAll("[^\\p{ASCII}]+", fallback) }