mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
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".
This commit is contained in:
parent
eba5ea7a4f
commit
73b03e98a7
1 changed files with 4 additions and 2 deletions
|
@ -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)))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue