Division symbol in text file in raw folder

*爱你&永不变心* 提交于 2019-12-20 03:41:36

问题


I have ÷ in .txt file in my android. When this division symbol is shown on android device, I see "�"

To make it worse, my laptop doesn't have division sign on keyboard. I used the above sign from wikipedia.

Any guess how can I resolve this.


回答1:


You should use the Unicode value for any symbols such as the division symbol you have here.

Try the Unicode U00F7.

When using it within a String format like "\u00F7".




回答2:


The problem is most likely a font issue, or possibly a unicode encoding issue. The character you pasted is unicode codepoint 0xF7: if the font being used to display your text file does not have a specific glyph for this codepoint, then it will render it using some reserved glyph like the question mark diamond you show. The solution in this case would be to install and use a font which includes an appropriate glyph for this codepoint. For instance, if it is displayed correctly in your web browser, then find out what font your browser is using, and try that. Of course, whether or not you can change the font used to display your text file depends on the application (at least I think: I don't think Android fixes the font across all apps).

Alternatively, it could be an encoding problem. For instance, if you're saving your text file in Latin-1 encoding, then this character will be stored in a single byte with value 0xF7. If the app that you're viewing the file with is assuming it's UTF-8, for instance, then this byte will be interpreted as the first of a multi-byte character, or it may even be invalid. If this is the case, you just need to make sure the encoding you use to save the file is the same as the one being used to display the file. Again, this would be application specific.



来源:https://stackoverflow.com/questions/18216620/division-symbol-in-text-file-in-raw-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!