1

enter image description here

The Java and XML files showing some random encrypted codes. Help me to fix this issue!

Prabhu
  • 306
  • 2
  • 7
  • Android Studio seems to have some sort of defect that messes up file encoding. You may need to re-install / upgrade to fix the issue: https://stackoverflow.com/questions/54910115/is-android-studio-corrupting-my-project-files or https://stackoverflow.com/questions/23677855/android-studio-unmappable-character-for-encoding-utf-8?noredirect=1&lq=1 or https://stackoverflow.com/questions/52716485/all-android-project-file-encoded-wrongly?noredirect=1&lq=1 – Surronie Mar 10 '20 at 07:07

1 Answers1

0

To me this sounds as if your xml file is not in UTF-8 but in some sort of 8-bit encoding. You usually see that error when your XML files contains a byte with value > 127. In my world that happens when users treat XML files as text that can be edited in Notepad. My guess would be that the original author of your XML generator did not understand what encodings are and thus slapped the as some sort of voodoo magic on the file without actually using UTF-8 in the stream.

You can either replace the XML header with one that states the correct encoding (maybe ISO-8859-1?)

or

you can search and replace all erroneous bytes (which is a pain, see http://en.wikipedia.org/wiki/UTF-8#I...byte_sequences )

or

You need to set the encoding of your xml as UTF 8. You can do so by right clicking on your file and then set File Encoding from the drop down.

actually u will not be able to see the utf-8 characters. You need to change the properties by doing: Go Configuration->Common->Encoding (UTF 8). I have never used Android studio but other editors work like this. I will update my answer according to your comments

Usman Khan
  • 121
  • 1
  • 12