[elephant-devel] Bug in string serialisation?
eslick at csail.mit.edu
Fri Jan 26 00:59:10 UTC 2007
We need a good set of unicode tests! I redesigned unicode support in
0.6.1 so I'm hoping these issues will go away, but I'd like to
What lisp are you using and what character coding, etc?
On Jan 25, 2007, at 6:40 PM, Pierre THIERRY wrote:
> I'm working on a web application that uses 0.6.0, and I may have hit a
> bug in Elephant.
> I have a fairly reproducible bug, when storing a string. I sometimes
> have to decode a badly-read string. E.g.:
> - I have "IdÃƒÂ©al"
> - I want "IdÃ©al"
> For this I use a function that if the Ãƒ character is found, decode
> string from UTF-8.
> (decode-string-if-needed "IdÃ©al") => "IdÃ©al"
> (decode-string-if-needed "IdÃƒÂ©al") => "IdÃ©al"
> The problem is when I store the result in a slot of a persistent
> I tried to store it manually quite some times, I never had any
> (setf (product-description p) "IdÃ©al")
> (product-description p) => "IdÃ©al"
> As illogic as it seems, if the slot is "IdÃƒÂ©al", the following:
> (setf (product-description p) (decode-string-if-needed (product-
> description p)))
> doesn't have the same result. If I retrieve the string from the slot,
> usually swank deconnects because it encountered strange characters.
> (map 'vector #'char-code "IdÃ©al") => #(73 100 233 97 108)
> (map 'vector #'char-code (product-description p)) => #(39 24
> 8483047 0 11)
> I wrote the following test macro:
> (defmacro test-conversion (location)
> `(let* ((bad ,location)
> (good (decode-string-if-needed bad))
> (setf ,location good)
> (let ((stored ,location))
> (mapcar (lambda (string) (map 'vector #'char-code string))
> (list bad good stored))))))
> And I reliably got the following:
> (setf (product-description p) "IdÃƒÂ©al")
> (test-conversion (product-description p))
> => (#(73 100 195 169 97 108)
> #(73 100 233 97 108)
> #(39 24 15187975 0 11))
> Does someone understand what could be going on?
> nowhere.man at levallois.eu.org
> OpenPGP 0xD9D50D8A
> elephant-devel site list
> elephant-devel at common-lisp.net
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 186 bytes
Desc: This is a digitally signed message part
More information about the elephant-devel