This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.

Ticket 464: Add optional start and end parameters to utf8->string and string->utf8.

2012-10-07 12:39:38
WG1 - Core
cowan
major
aag
fixed
source
closed
2012-07-15 12:47:53
defect

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

statusnewdecided

WG1 voted to adopt this change for both procedures.

owneralexshinncowan
statusdecidedwriting
resolutionfixed
statuswritingclosed