PDA

View Full Version : Could not decode <filename> with "UTF-8"-encoding. Editing not possible



Momergil
28th May 2013, 20:10
Hello!

Since some days ago a interesting problem appeared in my Qt Creator. Suddenly some files of some projects I created with my current Qt Creator and Qt library versions began to show the message in the title. That's funny, since this never happened before and my files should be in UTF-8. Some special characters of the codes were changed to an interrogation point (?), an another interesting thing that happened in the first day that this happened was that when I opened my Qt Creator, the background color of the editor was white while I always use it black and I didn't change the color recently.

Looking for this problem on the Internet, I found some topics in forums dealing with it, but always the file had being corrupted due to some crash in the PC while executing Qt Creator or else the problem appeared when somebody had changed the development environment (e.g. moving from Linux to Mac), quite a different situation from mine. The greatest problem I noticed is that the only way that it seems possible to correct this problem is either creating a new project and copying the code to there (I did this with the first project where this problem appeared and not it's fine) or else using some other editor such as Notepad++ to save the files again in UTF-8, both actions that are unacceptable given the fact I have at least half a dozen of quite big Qt projects to do it.

Could somebody gives me 1) an explanation of what could have happened given my specific case and 2) how can I solve this problem with a efficient way?


Thanks,

Momergil

ChrisW67
29th May 2013, 04:48
I am guessing the file name (not content) is encoded in a some local 8-bit form (Windows-1252, ÀÁõö÷øùúûüýþ ¿ and following char(s) perhaps?) that cannot possibly be interpreted as UTF8 (http://en.wikipedia.org/wiki/UTF-8#Invalid_byte_sequences). I think only ÁÀõú would be part of the the Portuguese alphabet. You need to fix the encoding.