In response Marijn's message below, I'm adding a proposal to the ballot that we support optional start and end parameters to utf8->string and to string->utf8.
Date: Fri, 13 Jul 2012 09:51:10 +0200 From: Marijn <hkBst@gentoo.org> Subject: [Scheme-reports] decoding strings from bytevectors
Hi,
I recently ran into this minor issue writing some R6RS code and would like to know how R7RS addresses it.
Say you want to extract a string from a bytevector, but the bytevector contains other information before and after the bytes that encode the string data. In R6RS, AFAIK, you have to copy those bytes to a new bytevector and then decode that entire bytevector to a string (probably causing another copy operation). I think it would be useful if something like
(define (string-decoder bytevector position length transcoder (bytevector->string (let ((bv (make-bytevector length))) (bytevector-copy! bytevector position bv 0 length) bv) transcoder) )
were supported directly by bytevector->string without the additional bytevector-copy.
Marijn
WG1 voted to adopt this change for both procedures.