From: Pekka N. <pek...@wl...> - 2007-01-13 13:35:21
|
Hi, I have two files with similar text in them: First line Sec line 3rd line First file is saved as "UTF16-LE" with BOM and I read one line from it like this: (with-open-file (stream "/home/pekka/practicalcl/test_utf16.txt" :external-format "utf-16") (format t "~a~%" (read-line stream))) First line NIL All fine. But when I save the file in "UTF-8" with BOM I get this: CL-USER> (with-open-file (stream "/home/pekka/practicalcl/test_utf8.txt" :external-format "utf-8") (format t "~a~%" (read-line stream))) First line # Note here the extra blank. Pekka. NIL Another try fails too: CL-USER> (with-open-file (stream /home/pekka/practicalcl/test_utf8.txt") (format t "~a~%" (read-line stream))) CFirst line First line # Note here the extra "C". Pekka. NIL How can I read "UTF-8" file so that BOM is not processed IF it exists? Fraction of my .emacs: ----------------- .emacs ------------------------------- ;;;; SLIME Setup (add-to-list 'load-path "C:/home/pekka/slime/") (set-language-environment "UTF-8") (setq slime-net-coding-system 'utf-8-unix) (require 'slime) (slime-setup :autodoc t) (setq common-lisp-hyperspec-root "file://C:/home/pekka/HyperSpec/") (setq inferior-lisp-program "C:/bin/clisp-2.41/clisp.exe -I -q -K full -E utf-8") ------------------------------------------------ -pekka- |
From: Sam S. <sd...@gn...> - 2007-01-14 15:10:05
|
> * Pekka Niiranen <crxxn.avvenara@jynaznvy.pbz> [2007-01-13 15:30:14 +0200]: > > But when I save the file in "UTF-8" with BOM I get this: CLISP does not support BOM. please save your file with plain UTF-8. -- Sam Steingold (http://sds.podval.org/) on Fedora Core release 6 (Zod) http://memri.org http://pmw.org.il http://palestinefacts.org http://camera.org http://dhimmi.com http://openvotingconsortium.org http://truepeace.org Linux: Telling Microsoft where to go since 1991. |
From: Pekka N. <pek...@wl...> - 2007-01-15 18:54:53
|
Sam Steingold wrote: >> * Pekka Niiranen <crxxn.avvenara@jynaznvy.pbz> [2007-01-13 15:30:14 +0200]: >> >> But when I save the file in "UTF-8" with BOM I get this: > > CLISP does not support BOM. > please save your file with plain UTF-8. > Thank you for your answer. Sadly I cannot remove BOM but I will try to "strip" it if the line starts with it as I do in the Python program I am trying to convert into Lisp: # Strip the BOM from the beginning of the Unicode string, if it exists u.lstrip( unicode( codecs.BOM_UTF8, "utf8" ) ) Another issue: I am reading "Practical Common Lisp" and in "chapter 15" it speaks about "quirks" in Clisp's design when it comes in listing directories. As a beginner, I find it bad publicity for Clisp. Furthermore, I would like to see Clisp being ported into latest OpenBSD too. Any comments? -pekka- |
From: Sam S. <sd...@gn...> - 2007-01-15 20:36:59
|
> * Pekka Niiranen <crxxn.avvenara@jynaznvy.pbz> [2007-01-15 20:56:08 +0200]: > > Another issue: I am reading "Practical Common Lisp" > and in "chapter 15" it speaks about "quirks" in Clisp's design > when it comes in listing directories. > As a beginner, I find it bad publicity for Clisp. "there is no such thing as bad publicity" :-) > Furthermore, I would like to see Clisp being ported into > latest OpenBSD too. Any comments? I am not aware of any problems. CLISP front page links to the OpenBSD port. -- Sam Steingold (http://sds.podval.org/) on Fedora Core release 6 (Zod) http://dhimmi.com http://openvotingconsortium.org http://truepeace.org http://thereligionofpeace.com http://mideasttruth.com http://palestinefacts.org Live Lisp and prosper. |