Support UFFI's new internationalized string capabilities.
authorKevin Rosenberg <kevin@rosenberg.net>
Sun, 7 Feb 2010 03:16:33 +0000 (20:16 -0700)
committerKevin Rosenberg <kevin@rosenberg.net>
Sun, 7 Feb 2010 03:16:33 +0000 (20:16 -0700)
ChangeLog
tests/test-i18n.lisp
uffi/clsql-uffi.lisp

index d227ac85fd90c775c9f6ccb67851de62ac737dcb..d00e9dbb784c4347e69379a70dfcd0b506246661 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-02-06  Kevin Rosenberg <kevin@rosenberg.net>
+       * tests/test-i18n.lisp: Bind UFFI:*DEFAULT-EXTERNAL-FORMAT*
+       for testing multibyte encodings.
+       * uffi/clsql-uffi.lisp: Changes for UFFI 1.7.4's new support
+       for encoding foreign strings with a specified external format.
+
 2010-02-06  Kevin Rosenberg <kevin@rosenberg.net>
        * sql/metaclasses.lisp: If no declared slot type in
        compute-lisp-type-from-specified-type, then use t as lisp type.
index 6374a3f00158693982043ffce531614cd672fd15..4a6cf67d42bc3a068a961a33994e2455535d031d 100644 (file)
@@ -4,10 +4,10 @@
 ;;;;
 ;;;; Name:    test-i18n.lisp
 ;;;; Purpose: Tests for passing non-ascii encoded strings to db and back
-;;;; Author:  Nathan Bird
+;;;; Author:  Nathan Bird & Kevin M. Rosenberg
 ;;;; Created: Feb 2010
 ;;;;
-;;;; This file, part of CLSQL, is Copyright (c) 2002-2010 by Kevin M. Rosenberg
+;;;; This file is part of CLSQL.
 ;;;;
 ;;;; CLSQL users are granted the rights to distribute and use this software
 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
 ;;; UTF-8 for example can handle these easily.
 ;; I show this as a 20char string and 27 bytes in utf-8
 (deftest :basic/i18n/1
-    (first (query "SELECT 'Iñtërnâtiônàlizætiøn'"
-                 :flatp t :field-names nil))
-  "Iñtërnâtiônàlizætiøn")
+ (let ((uffi:*default-external-format* :utf-8))
+   (first (query "SELECT 'Iñtërnâtiônàlizætiøn'"
+                 :flatp t :field-names nil)))
+ "Iñtërnâtiônàlizætiøn")
 
 ;; the z in this one is even stronger
 ;; I show this as a 20char string and 28 bytes in utf-8
 (deftest :basic/i18n/2
-    (first (query "SELECT 'Iñtërnâtiônàližætiøn'"
-                 :flatp t :field-names nil))
-  "Iñtërnâtiônàližætiøn")
+ (let ((uffi:*default-external-format* :utf-8))
+   (first (query "SELECT 'Iñtërnâtiônàližætiøn'"
+                 :flatp t :field-names nil)))
+ "Iñtërnâtiônàližætiøn")
 
 ))
index fda60ecf21aee1332a5d348f09072982c8154c5f..e08c157432c1b8fb5feca9a860d0b938cdedda71 100644 (file)
           (uffi:convert-from-foreign-string char-ptr :locale :none)
           #-sb-unicode
           (if length
-              (uffi:convert-from-foreign-string char-ptr :locale :none
+              (uffi:convert-from-foreign-string char-ptr
                                                 :null-terminated-p nil
                                                 :length length)
-            (uffi:convert-from-foreign-string char-ptr :locale :none))))))))
+            (uffi:convert-from-foreign-string char-ptr))))))))