About character set inconsistency
Sandro Pedrazzini <[email protected]> Mon, 12 Apr 2010 18:37:00 +0200
| Newsgroups | gmane.lisp.mcl.general |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
I am using RMCL 5.2.1 on Mac Intel (Leopard)
I have a character set inconsistency between output to file and input
from file. I wonder if I am doing some wrong assumptions, or I just
need to set some flags.
The problem: writing characters to a file, outputs them in ISO-Latin-1
(I can verify this opening the generated file with TextEdit plain text
encoding Western ISO-Latin 1). Reading the same file using the (read)
function, seems to interpret them in Mac OS Roman.
Here is how to reconstruct the problem:
1. Class to passivate, containing a string:
(defclass character-sequence()
((content :initform "a ä ö ü $"
:initarg :content
:accessor content)))
2. Write an object of this class to a file:
(with-open-file (outfile "characters.out"
:direction :output
:if-exists :supersede
:if-does-not-exist :create)
(let ((char-sequence (make-instance 'character-sequence)))
(format outfile "#[character-sequence (:content ~s)" (content
char-sequence))))
Now: opening the file with TextEdit, Western ISO-Latin 1, gives
following, which means that this is the used encoding:
#[character-sequence (:content "a ä ö ü $")
3. Reading the file and outputting the string to the listener:
(with-open-file (infile "characters.out")
(let ((char-sequence (read infile)))
(format nil "~s" (content char-sequence))))
This gives following result on the listener: "a ‰ ˆ ¸ $"
Which is the same as reading the file with TextEdit, using the
encoding Mac OS Roman: #[character-sequence (:content "a ‰ ˆ ¸ $)",
which means that the input tries to interpret the file content as Mac
OS Roman.
Did anyone encounter a similar problem?
How to change the default, or at least synchronize the input and
output defaults?
Best regards
Sandro
_______________________________________________
info-mcl mailing list
[email protected]
http://clozure.com/mailman/listinfo/info-mcl