|
|
|
@ -15,7 +15,10 @@ import Foundation
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (self.hasExcessiveDiacriticals(text: text)) {
|
|
|
|
|
return text.folding(options: .diacriticInsensitive, locale: .current)
|
|
|
|
|
Logger.warn("\(TAG) filtering text for excessive diacriticals.")
|
|
|
|
|
let filteredText = text.folding(options: .diacriticInsensitive, locale: .current)
|
|
|
|
|
assert(!self.hasExcessiveDiacriticals(filteredText))
|
|
|
|
|
return filteredText
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return text
|
|
|
|
@ -26,7 +29,7 @@ import Foundation
|
|
|
|
|
for char in text.characters.enumerated() {
|
|
|
|
|
let scalarCount = String(char.element).unicodeScalars.count
|
|
|
|
|
if scalarCount > 4 {
|
|
|
|
|
Logger.warn("\(TAG) filtering undisplayable text \(char.element) scalarCount: \(scalarCount)")
|
|
|
|
|
Logger.warn("\(TAG) detected excessive diacriticals at \(char.element) scalarCount: \(scalarCount)")
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|