[fpc-devel] TStringList.LoadFromFile and SavetoFile - file encoding support
Michael Van Canneyt
michael at freepascal.org
Tue Feb 3 09:39:58 CET 2009
On Tue, 3 Feb 2009, Vincent Snijders wrote:
> Graeme Geldenhuys schreef:
> > On Tue, Feb 3, 2009 at 9:02 AM, Vincent Snijders
> > <vsnijders at vodafonevast.nl> wrote:
> > > I am a Lazarus developer, and I don't think I said it like that.
> >
> > I wasn't pointing fingers to you Vincent. :-) I summarized what a few
> > people have said.
> >
> > > LoadFromFile in a LCL control, you need to make sure they are valid UTF8
> > > strings. And honestly, it is only you who make sure that it is, because
> > > you
> > > know the initial encoding.
> >
> > The problem is as follows.... Even though I am a long time developer,
> > I often have no clue what encoding a file is in when I look at the
> > file using Nautilus file manager. I often open a file in my preferred
> > text editor, look if it displays correctly, then look in the statusbar
> > area for what encoding the editor detected (at least my editor does
> > that nicely).
> >
>
> The LCL does not have this feature. It can only handle UTF8. period.
>
> > So even though you are using something as simple as the TMemo in LCL,
> > and LCL always wants UTF-8, how do you know what encoding to convert
> > from to UTF-8?
>
> If you don't know, you cannot process it. Simple.
This is why many editors and mail programs have a menu option 'Encoding':
because they also don't know, and they cannot know without external means,
what the encoding is.
Michael.
More information about the fpc-devel
mailing list