From 3b0f3c991b373e3f1734bc624ba6e04ccafea357 Mon Sep 17 00:00:00 2001 From: Kevin Rosenberg Date: Sat, 6 Feb 2010 20:16:33 -0700 Subject: [PATCH] Support UFFI's new internationalized string capabilities. --- ChangeLog | 6 ++++++ tests/test-i18n.lisp | 18 ++++++++++-------- uffi/clsql-uffi.lisp | 4 ++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index d227ac8..d00e9db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-02-06 Kevin Rosenberg + * 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 * sql/metaclasses.lisp: If no declared slot type in compute-lisp-type-from-specified-type, then use t as lisp type. diff --git a/tests/test-i18n.lisp b/tests/test-i18n.lisp index 6374a3f..4a6cf67 100644 --- a/tests/test-i18n.lisp +++ b/tests/test-i18n.lisp @@ -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 @@ -23,15 +23,17 @@ ;;; 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") )) diff --git a/uffi/clsql-uffi.lisp b/uffi/clsql-uffi.lisp index fda60ec..e08c157 100644 --- a/uffi/clsql-uffi.lisp +++ b/uffi/clsql-uffi.lisp @@ -147,8 +147,8 @@ (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)))))))) -- 2.34.1