I said not just about text files in IDE (it is not really interesting), but
about pascal project files. Where to store encoding?
It is a good question. The easiest way is to add a string to the .lpi file
which either contains the locale of all the project (but it is not so easy to
completely convert from UTF8 to any encoding) or just a boolean means either
the project uses the system encoding or UTF8. If it uses the system encoding,
and we are not in Windows (or in Windows but using utf8), SynEditTextBuffer
should use somewhat like AnsiToUTF8 when loading any project file. If it uses
UTF8 and we are in Windows, the conversion from UTF8 should be used. It seems
quite easy to make.
Let UTF8 be standard international mode while system encoding is a
compatibility mode.
When the problem of project encoding will be solved, it is possible to go
further. Most files
loaded in projects will be loaded in project encoding. But some files may be in
other encoding
(it is a problem of user-programmer to make them to compiled correctly by fpc).
In this case the first line of such a file should indicate this, may be
//&encoding=koi8r
So, reader should try to read a line (may be some lines), and if it won't find
something like this, it will turn encoding to project default, and then reset
the position. If it find it, it will set mechanism to loaded enc. conversion
and reset the position too.
The same thing will be done by writer. So, to change the encoding of a source
file you will need just to add such a comment.
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives