Clozure CL and unicode on Windows
Posted: Mon Oct 19, 2009 8:49 pm
Greetings!
I'm having problems with reading unicode files (using (with-open-file) and (read)) that contain byte-order-mark. It seems CCL just stops reading the file after the BOM and returns the BOM as the data it has read.
Here is the code:
First, create a unicode file:
Second, read the data back:
After I execute the above code I tell the CCL "x" and it replies "\→" instead of "abc".
If I remove the BOM from the file and reread it then x is what I wrote to the file, i.e. "abc".
The same example (writing and reading the same file) works fine under CLISP (with the exception of replacing ":utf-16" with "charsets:utf-16"): the file written is the same as from CCL (it starts with 0xFEFF), data is read back successfully, x is "abc".
Could anyone help me with with?
OS is Windows.
CCL is 1.3-r11936 (WindowsX8632)
CLISP is 2.48.
Thanks.
I'm having problems with reading unicode files (using (with-open-file) and (read)) that contain byte-order-mark. It seems CCL just stops reading the file after the BOM and returns the BOM as the data it has read.
Here is the code:
First, create a unicode file:
Code: Select all
(with-open-file (f "f" :direction :output :external-format :utf-16) (write "abc" :stream f))
Code: Select all
(setf x (with-open-file (f "f" :direction :input :external-format :utf-16) (read f)))
If I remove the BOM from the file and reread it then x is what I wrote to the file, i.e. "abc".
The same example (writing and reading the same file) works fine under CLISP (with the exception of replacing ":utf-16" with "charsets:utf-16"): the file written is the same as from CCL (it starts with 0xFEFF), data is read back successfully, x is "abc".
Could anyone help me with with?
OS is Windows.
CCL is 1.3-r11936 (WindowsX8632)
CLISP is 2.48.
Thanks.