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 understand it.

What lisp are you using and what character coding, etc?

Ian

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 the
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 class. I tried to store it manually quite some times, I never had any problem:

(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?

Strangely,
Pierre
--
[EMAIL PROTECTED]
OpenPGP 0xD9D50D8A
_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

Reply via email to