This commit is contained in:
Robby Findler 2014-11-25 21:18:24 -06:00
parent 5fca59e2ed
commit 0083f1c9ae
2 changed files with 20 additions and 1 deletions

View File

@ -2893,7 +2893,7 @@
[else
(define leftovers (subbytes the-bytes src-read-amt (bytes-length the-bytes)))
(at-enqueue (cons leftovers key) remainder-re-enqueued)]))
(define converted-str (bytes->string/utf-8 (subbytes the-bytes 0 src-read-amt)))
(define converted-str (bytes->string/utf-8 converted-bytes))
(values (reverse (cons (cons converted-str key) acc))
new-at-queue
too-many-bytes?)]

View File

@ -397,6 +397,25 @@
(void (write-bytes ,(subbytes bts 1 (bytes-length bts)) p))
(flush-output p)
(send t get-text))))))
(let ([b (bytes 195 195 (char->integer #\a))])
(test
'text:ports%.broken-encoding
(λ (x)
(define c (bytes-open-converter "UTF-8-permissive" "UTF-8"))
(define-values (result-bytes src-read-amt termination) (bytes-convert c b))
(equal? x (bytes->string/utf-8 result-bytes)))
(λ ()
(queue-sexp-to-mred
`(let ()
(define t (new (text:ports-mixin text:wide-snip%)))
(define p (send t get-out-port))
(yield
(thread
(λ ()
(write-bytes ,b p)
(flush-output p))))
(send t get-text))))))
;; the next tests test the interaction when the current