fix error reporting in `reencode-input-port'

Closes PR 12076
This commit is contained in:
Matthew Flatt 2011-07-25 13:11:05 -04:00
parent 73b16c8578
commit e01ee43300
2 changed files with 6 additions and 1 deletions

View File

@ -1332,7 +1332,7 @@
[newline-convert? #f]
[decode-error (lambda (msg port)
(error 'reencode-input-port
(format "~a: ~e" msg)
(format "~a: ~~e" msg)
port))])
(let ([c (let ([c (bytes-open-converter encoding "UTF-8")])
(if newline-convert? (mcons c #f) c))]

View File

@ -722,6 +722,11 @@
(test #\c read-char ei)
(test eof read-char ei)))
(err/rt-test
(port->bytes (reencode-input-port (open-input-bytes #"\xFF\xFF") "utf-8"))
(lambda (exn)
(regexp-match? #rx"^reencode-input-port:" (exn-message exn))))
;; --------------------------------------------------
(let-values ([(in out) (make-pipe)])