Search code examples
androidglyph

Android Issue displaying special characters


Issue with "á,é,í, ñ

Im having an issue displaying special characters. I was told there was an error in the encoding. Im running the application on the test devices I have, and I mot getting this error. The person getting this error, is testing the app on the same device model, but with a newer firmware version.

I was told "that glyph is the replacement character. you've screwed up your file encoding somewhere. everything should be UTF-8 to preserve sanity." yet, it runs fine on my device.

is there a known fix for this type of problem. thnx!

EDIT- Below is an image of an error I got when I tried to copy the code written by an engineer in china..having never collaborated before like this Im not sure if this is acommon issue which ends up being reflected on the apputf-8 errorenter image description here


Solution

  • well ... why are you defining strings in your .java file? they need to exist in strings.xml eventually in order to be localized, and regardless, that is the Android way.

    if you look at the top of your strings.xml file, you see a line like this,

    <?xml version="1.0" encoding="utf-8"?>
    

    that tells whatever consumes this file that the characters are encoded as UTF-8 (obviously). you will find no such line in your .java file. it's going to be encoded as the eclipse default, which depends on your host OS, and is almost certainly not UTF-8. your special characters are lost in the encoding processes when your .java files are saved.