From cmucl-devel at common-lisp.net Sun Jan 24 05:36:28 2010 From: cmucl-devel at common-lisp.net (cmucl) Date: Sun, 24 Jan 2010 05:36:28 -0000 Subject: [cmucl-ticket] [cmucl] #36: file-position broken for utf16 and utf32 Message-ID: <052.abece47505902f36eb5d5040f3f75545@common-lisp.net> #36: file-position broken for utf16 and utf32 --------------------+------------------------------------------------------- Reporter: rtoy | Owner: somebody Type: defect | Status: new Priority: minor | Milestone: Component: Core | Version: 19f Keywords: | --------------------+------------------------------------------------------- Consider this code: {{{ (defun bug (&optional (format :utf16)) (with-open-file (s "/tmp/bom.txt" :direction :output :if-exists :supersede :external-format format) (format s "Hello~%")) (with-open-file (s "/tmp/bom.txt" :direction :input :external-format format) (print (read-char s)) (print (file-position s))) (values)) }}} Running {{{(bug :utf16)}}} produces {{{ #\H 2 }}} {{{(bug :utf32)}}} produces {{{ #\H 4 }}} In both cases, the actual position is wrong. For utf16, the position should 4; utf32, 8. The BOM has been ignored. This is caused by {{{STRING-ENCODE}}} outputting the BOM for these formats. {{{STRING-ENCODE)}}} is used to figure out how many octets have not yet been processed but have been read from the file. If the BOM was not output, the position would be correct. This bug (will) occur in the 2010-02 snapshot and later. -- Ticket URL: cmucl cmucl From cmucl-devel at common-lisp.net Sun Jan 24 05:50:17 2010 From: cmucl-devel at common-lisp.net (cmucl) Date: Sun, 24 Jan 2010 05:50:17 -0000 Subject: [cmucl-ticket] [cmucl] #36: file-position broken for utf16 and utf32 In-Reply-To: <052.abece47505902f36eb5d5040f3f75545@common-lisp.net> References: <052.abece47505902f36eb5d5040f3f75545@common-lisp.net> Message-ID: <061.dce82fb93be7e708cee97db068210956@common-lisp.net> #36: file-position broken for utf16 and utf32 ---------------------+------------------------------------------------------ Reporter: rtoy | Owner: somebody Type: defect | Status: new Priority: minor | Milestone: Component: Core | Version: 2010-01 Resolution: | Keywords: ---------------------+------------------------------------------------------ Changes (by rtoy): * version: 19f => 2010-01 -- Ticket URL: cmucl cmucl