[Qt-creator] "Editing not possible" solution
Frédéric Marchal
frederic.marchal at wowtechnology.com
Fri Jan 23 15:42:32 CET 2015
On Friday 23 January 2015 14:24:30, Ziller Eike wrote :
> > On Jan 21, 2015, at 7:20 AM, Frédéric Marchal
> > <frederic.marchal at wowtechnology.com> wrote:
> > What would be more reasonable is to have one fallback encoding when
> > UTF-8 fails and a BOM was expected.
> >
> > Without BOM, it is unreliable and would fail if the file contains some
> > characters from another character set but that happen to match valid
> > UTF-8 sequences. In that case, the file would be wrongly opened as
> > UTF-8.
>
> If you set an encoding to use in Qt Creator, either globally or for your
> project, then files that have UTF BOM are opened as UTF, and all others
> are opened with that encoding you set. Do I understand correctly that this
> is what you propose here as well?
It is not exactly the same.
The current behavior requires a BOM at the beginning of every UTF-8 encoded
file. QtCreator is then configured with a non UTF-8 default character set to
serve as a fallback when the BOM is missing.
I had in mind to have a second character encoding to use when UTF-8 fails (or
UTF-16 or any encoding that can do some kind of validation).
To explain a bit more, I have many old source files encoded with Windows1252
that I can't convert to UTF-8 (because they are still compiled with an old
compiler that doesn't know about UTF-8). But contrary to the OP, I know the
encoding is Windows1252 when UTF-8 fails. Having a fallback encoding would
spare me the same repetitive action when I open a Windows1252 encoded file.
I'm also reluctant to add a BOM to the source files that are UTF-8 because I
don't know how portable the BOM is. I don't want to start using a BOM to find
out much later that it doesn't work with one of the many programs I sometime
use to edit files. I'm thinking about sed, some perl scripts I wrote to do
various tasks, other old programs whose origin is uncertain…
Note that it is certainly a very very low priority task (not worth mentioning)
if I'm the only one asking for it! :-)
Frederic
More information about the Qt-creator
mailing list