From: Chris Hanson Date: Thu, 3 Jul 2003 16:47:49 +0000 (+0000) Subject: Emit non-ASCII chars using &#...; notation. X-Git-Tag: 20090517-FFI~1885 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=2bd3b2bd9ff3dac7484692972740d37a6ecb5577;p=mit-scheme.git Emit non-ASCII chars using &#...; notation. --- diff --git a/v7/src/xml/xml-output.scm b/v7/src/xml/xml-output.scm index 54e971260..972cdcdd8 100644 --- a/v7/src/xml/xml-output.scm +++ b/v7/src/xml/xml-output.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: xml-output.scm,v 1.18 2003/03/09 17:17:06 cph Exp $ +$Id: xml-output.scm,v 1.19 2003/07/03 16:47:49 cph Exp $ Copyright 2001,2002,2003 Massachusetts Institute of Technology @@ -60,7 +60,13 @@ USA. (apply %make-ctx 'PORT port options)) (define (emit-char char ctx) - (write-char char (ctx-port ctx))) + (let ((port (ctx-port ctx))) + (if (fix:< (char->integer char) #x80) + (write-char char port) + (begin + (write-string "&#x" port) + (write-string (number->string (char->integer char) 16) port) + (write-string ";" port))))) (define (emit-string string ctx) (write-string string (ctx-port ctx)))