问题描述
我正在开发一个调用休息Web服务的应用程序。有时,xml响应包含手机无法显示的字符。显示这些字符时,会显示一个空白框。我想过滤掉这些字符。如何检测人物是否能够在屏幕上显示?某些特定字符包括:
Android支持以下
- Xml.Encoding ISO_8859_1
- Xml.Encoding US_ASCII
- Xml.Encoding UTF_16
- Xml.Encoding UT F_8
US_ASCII不应该有任何问题。
对于ISO_8859_1你请检查
用于控制字符0x00-0x1f和0x7f-0x9f并进行过滤。
当然使用匹配的字体。
使用UTF_8或16更复杂,请阅读Joels
你可能会发现这个邮件的有用。
I am working on an app which calls a rest web service. Sometimes the xml responses contain characters which the phone can not display. When displaying these characters, an empty box is displayed instead. I would like to filter out these characters. How can I detect if a character will be able to be displayed on the screen?
Some specific characters include:
http://www.fileformat.info/info/unicode/char/0094/index.htmhttp://www.fileformat.info/info/unicode/char/0080/index.htmhttp://www.fileformat.info/info/unicode/char/0092/index.htm
Android support the following encodings
- Xml.Encoding ISO_8859_1
- Xml.Encoding US_ASCII
- Xml.Encoding UTF_16
- Xml.Encoding UTF_8
US_ASCII shouldn't make any problems.
For ISO_8859_1 you sould check http://en.wikipedia.org/wiki/ISO/IEC_8859-1for control chars 0x00-0x1f and 0x7f-0x9f and filter them.And of course use a matching font.
Using UTF_8 or 16 is more complex, read Joels The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets
You might find this mailing list useful.
这篇关于如何从Web服务中删除无法识别的字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!