summaryrefslogtreecommitdiff
path: root/module/rnrs
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2010-06-20 23:15:29 +0200
committerAndy Wingo <wingo@pobox.com>2010-06-20 23:15:29 +0200
commit73b03e98a74b213ecb8907a649e0d00234cf237d (patch)
tree5501d76ce680a1538d8e20a597f992352c29f7ad /module/rnrs
parenteba5ea7a4f780115cd49c90bcec7624d5481802b (diff)
downloadguile-73b03e98a74b213ecb8907a649e0d00234cf237d.tar.gz
ensure unicode-capable rnrs string ports
* module/rnrs/io/ports.scm (open-string-input-port): (open-string-output-port): Ensure that the ports are unicode-capable by binding %default-port-encoding to "UTF-8".
Diffstat (limited to 'module/rnrs')
-rw-r--r--module/rnrs/io/ports.scm6
1 files changed, 4 insertions, 2 deletions
diff --git a/module/rnrs/io/ports.scm b/module/rnrs/io/ports.scm
index 4916bba45..04dabe6c9 100644
--- a/module/rnrs/io/ports.scm
+++ b/module/rnrs/io/ports.scm
@@ -110,12 +110,14 @@ read from/written to in @var{port}."
(define (open-string-input-port str)
"Open an input port that will read from @var{str}."
- (open-input-string str))
+ (with-fluids ((%default-port-encoding "UTF-8"))
+ (open-input-string str)))
(define (open-string-output-port)
"Return two values: an output port that will collect characters written to it
as a string, and a thunk to retrieve the characters associated with that port."
- (let ((port (open-output-string)))
+ (let ((port (with-fluids ((%default-port-encoding "UTF-8"))
+ (open-output-string))))
(values port
(lambda () (get-output-string port)))))