Re: Character encodings issue with phrase_from_file

Pierpaolo Bernardi <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CANY8u7FJYdz_06O_nEtkMC-Q+Wqe3NST3+4HXUV_9Db3VHcMGA@mail.gmail.com>
On Sun, Aug 18, 2013 at 2:27 AM, Warren Wilkinson
<[email protected]> wrote:
> Too long didn't read:  My input file has ascii \223 and \224.  If I take
> them out, phrase_from_file succeeds. If I leave them in, it fails.  What
> can I do?

If you read the docs for phrase_from_file, you see that there is a
phrase_from_file/2 and a phrase_from_file/3.
This second predicate takes an additional 'Options' argument.  One of
these optional arguments is an encoding specification.  You must pass
the correct encoding.

The page for the file says: "This file contains the SR25 data in ASCII
(ISO/IEC 8859-1)", which is a contradiction. :)

Let's assume the file actually is 8859-1 (aka latin-1), and not ASCII,
so pass the options [encoding(iso_latin_1)] to phrase_from_file/3.

Hope this works.

P.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.