[elephant-devel] Issue of using Unicode in Elephant

Li Gong ligong.ch at gmail.com
Wed Jul 30 14:53:02 UTC 2008


Hello,

       I'm new to Elephant.
       My computer environment is: FreeBSD 6.2,  Elephant 0.9.1, SBCL
1.0.13, BDB 4.5. (  All elephant test cases for BDB are passed. )
       I met some  problems related to Unicode.

       1.  Unicode contained  in a vector can not be serialized.
            This issue is found when I submit a form to hunchentoot, which
uses vector to store the submitted input string instead of simple array.

             Following codes illustrate the problem.

         (defpclass user ()
            ((login-name :accessor user-login-name :initarg :login-name
:index t)
              (nick-name :accessor user-nick-name :initarg :nick-name :index
t)
              (password :accessor user-password :initarg :password)))


         (defvar *login-name1* nil)
         (setf *login-name1* (make-array 9 :element-type 'character
:adjustable t :fill-pointer 0))
         (vector-push #\u5c0f *login-name1*)
         (vector-push #\u5c0f *login-name1*)
         (vector-push #\u660e *login-name1*)

         (make-instance 'user :login-name *login-name1* :nick-name "Richard"
:password "123")

          Error message:
          ---------------------------------------------
          The value "小小明" is not of type SIMPLE-STRING.
           [Condition of type TYPE-ERROR]

         Backtrace:
         0: (ELEPHANT-SERIALIZER2::SERIALIZE-TO-UTF16LE #<unavailable
argument> #<unavailable argument>)
         1: (ELEPHANT-SERIALIZER2::SERIALIZE-STRING #<unavailable argument>
#<unavailable argument>)
         2: (ELEPHANT-SERIALIZER2::SERIALIZE #<unavailable lambda list>)

         Changing the vector to simple array can work around it:

        (make-instance 'user :login-name (copy-seq *login-name1*) :nick-name
"Richard" :password "123")

         Is it a known limitation ?

       2.  If the number of characters is odd, the Unicode string can not be
used for index,

         (get-instance-by-value 'user 'login-name (copy-seq *login-name1*))
         => nil
          (get-instance-by-value 'user 'nick-name "Richard")
         => > #<USER oid:5>

          If I change *login-name1* to  2, or 4 Unicode characters, the
get-instance-by-value works.
          But, if it contains 3 or 5 characters, the get-instance-by-value
always returns nil.

         Does anyone meet the similar problem before?

Thanks
Li
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/elephant-devel/attachments/20080730/f430c42c/attachment.html>


More information about the elephant-devel mailing list