Hi everyone!
I wrote a program which do processing of text file.
But when input is "ISO Latin 2" I get error
invalid byte #xF3 in CHARSET:ASCII conversion
I read impnotes for CLISP and found
ENV:ENCODING
and
CHARSET:ISO-8859-2
objects but description is hard to understand for me.
Anybody can help with this?
Regards
Miroslaw Osys
>>>>> "mo" == Miroslaw Osys <ยทยทยทยท@zeus.polsl.gliwice.pl> writes:
mo> I wrote a program which do processing of text file.
mo> But when input is "ISO Latin 2" I get error
mo> invalid byte #xF3 in CHARSET:ASCII conversion
mo>
mo> I read impnotes for CLISP and found
mo> ENV:ENCODING
mo> and
mo> CHARSET:ISO-8859-2
mo> objects but description is hard to understand for me.
in a CLISP compiled with Unicode support, there are several ways of
specifying the character set used for file I/O:
* specify the encoding explicitly, on a per-file basis, using
the :external-format argument to OPEN.
(with-open-file (f "foo.txt"
:direction :input
:external-format (ext:make-encoding
:charset "ISO-8859-2"
:line-terminator :unix))
...)
* set CUSTOM:*DEFAULT-FILE-ENCODING*, which affects all file I/O.
You can do this either from your CLISP initialization file, or
using the -Efile commandline option, or by setting your
locale-related environment variables.
,---- ~/.clisprc.lsp ---
| #+unicode
| (setf custom:*default-file-encoding*
| (ext:make-encoding :charset "ISO-8859-2" :line-terminator :unix))
`----
% clisp -Efile ISO-8869-2
% LC_ALL=fr_FR.UTF-8 clisp
(this requires your system to have the locale set up correctly)
<URL:http://clisp.cons.org/impnotes/encoding.html>
<URL:http://clisp.cons.org/impnotes/clisp.html#opt-enc>
--
Eric Marsden <URL:http://www.laas.fr/~emarsden/>