mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-29 13:26:50 +01:00
Force FlattenToAsciiTransliterator to return only ASCII
This commit is contained in:
parent
735f27d5bf
commit
0b241af8e7
@ -18,6 +18,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.util.language.impl;
|
package nodomain.freeyourgadget.gadgetbridge.util.language.impl;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.text.Normalizer;
|
import java.text.Normalizer;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ public class FlattenToAsciiTransliterator implements Transliterator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
txt = Normalizer.normalize(txt, Normalizer.Form.NFD);
|
txt = Normalizer.normalize(txt, Normalizer.Form.NFD);
|
||||||
|
txt = new String(txt.getBytes(StandardCharsets.US_ASCII), StandardCharsets.US_ASCII);
|
||||||
return txt.replaceAll("\\p{M}", "");
|
return txt.replaceAll("\\p{M}", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user