Remove non-ASCII characters from String in Java

前端 未结 5 1300
渐次进展
渐次进展 2021-01-04 00:06

I have a URI that contains non-ASCII characters like :

http://www.abc.de/qq/qq.ww?MIval=typo3_bsl_int_Smtliste&p_smtbez=Schmalbl�ttrigeSomerzischeruchtanb

5条回答
  •  感情败类
    2021-01-04 00:30

    Use Guava CharMatcher

    String onlyAscii = CharMatcher.ascii().retainFrom(original)
    

提交回复
热议问题