[fpc-pascal] How to know the encoding of a string?
Graeme Geldenhuys
mailinglists at geldenhuys.co.uk
Mon Oct 17 15:21:51 CEST 2016
On 2016-10-17 14:14, Marcos Douglas B. Santos wrote:
> My system are receiving some files and I don't know the encoding.
> I would like to know and then, convert it.
No such function [with exact results] exists anywhere (no matter the
programming language). The best programs can do is to interrogate the
contents of a file and make a best guess. How they do that
interrogation -- I unfortunately don't know. I guess you could look at
the source code of some of the open source text editors and see what
they do. Some text editors are much better than others. eg: EditPad Pro
(commercial) and jEdit (open source) are very good at these interrogations.
Alternatively, simply ask the person that supplies you with these files
to tell you want encoding they use. They must know the answer.
Regards,
Graeme
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
My public PGP key: http://tinyurl.com/graeme-pgp
More information about the fpc-pascal
mailing list