From 6a0f8fcdd66281e62b988fad4bdb3e6d6c216965 Mon Sep 17 00:00:00 2001 From: Alexey Dejneka Date: Tue, 2 Aug 2005 18:11:14 +0000 Subject: [PATCH] 0.9.3.18: * DEFINE-UNIBYTE-MAPPER defines correct externalization routine for encodings, swapping 8-bit codes. --- NEWS | 1 + src/code/octets.lisp | 4 ++-- tests/external-format.impure.lisp | 31 +++++++++++++++++++++++++++---- version.lisp-expr | 2 +- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index cae99e3..4eceb3b 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,7 @@ changes in sbcl-0.9.4 relative to sbcl-0.9.3: * minor incompatible change: *INVOKE-DEBUGGER-HOOK* is run before *DEBUGGER-HOOK* => *DEBUGGER-HOOK* is not run when the debugger is disabled + * bug fix: degree sign () could not be encoded in KOI8-R. changes in sbcl-0.9.3 relative to sbcl-0.9.2: * New feature: Experimental support for bivalent streams: streams diff --git a/src/code/octets.lisp b/src/code/octets.lisp index c499211..b68d59c 100644 --- a/src/code/octets.lisp +++ b/src/code/octets.lisp @@ -190,12 +190,12 @@ one-past-the-end" (declare (optimize speed (safety 0)) (type char-code code)) (case code - (,(mapcar #'car exceptions) nil) ,@(mapcar (lambda (exception) (destructuring-bind (byte code) exception `(,code ,byte))) exceptions) - (otherwise code))))) + (,(mapcar #'car exceptions) nil) + (otherwise (if (< code 256) code nil)))))) #!+sb-unicode (define-unibyte-mapper diff --git a/tests/external-format.impure.lisp b/tests/external-format.impure.lisp index d4e9cbd..d1a9644 100644 --- a/tests/external-format.impure.lisp +++ b/tests/external-format.impure.lisp @@ -15,9 +15,6 @@ ;;;; absolutely no warranty. See the COPYING and CREDITS files for ;;;; more information. -#-sb-unicode -(sb-ext:quit :unix-status 104) - (defmacro do-external-formats ((xf &optional result) &body body) (let ((nxf (gensym))) `(dolist (,nxf sb-impl::*external-formats* ,result) @@ -40,6 +37,10 @@ (loop for character across standard-characters do (assert (eql (read-char s) character)))))) +(delete-file "external-format-test.txt") +#-sb-unicode +(sb-ext:quit :unix-status 104) + ;;; Test UTF-8 writing and reading of 1, 2, 3 and 4 octet characters with ;;; all possible offsets. Tests for buffer edge bugs. fd-stream buffers are ;;; 4096 wide. @@ -134,6 +135,28 @@ (when p (delete-file p))))) -(delete-file "external-format-test.txt") + +;;;; KOI8-R external format +(with-open-file (s "external-format-test.txt" :direction :output + :if-exists :supersede :external-format :koi8-r) + (write-char (code-char #xB0) s) + (assert (eq + (handler-case + (progn + (write-char (code-char #xBAAD) s) + :bad) + (sb-int:character-encoding-error () + :good)) + :good))) +(with-open-file (s "external-format-test.txt" :direction :input + :element-type '(unsigned-byte 8)) + (let ((byte (read-byte s))) + (assert (= (eval byte) #x9C)))) +(with-open-file (s "external-format-test.txt" :direction :input + :external-format :koi8-r) + (let ((char (read-char s))) + (assert (= (char-code (eval char)) #xB0)))) + +(delete-file "external-format-test.txt") (sb-ext:quit :unix-status 104) diff --git a/version.lisp-expr b/version.lisp-expr index 5e2f013..7bcf166 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.3.17" +"0.9.3.18" -- 1.7.10.4