GNU bug report logs - #14109
No code for 'bytevector->string' and 'string->bytevector'

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guile; Severity: wishlist; Reported by: Nikita Karetnikov <nikita@HIDDEN>; dated Mon, 1 Apr 2013 04:39:02 UTC; Maintainer for guile is bug-guile@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Mark H Weaver <mhw@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 14109 <at> debbugs.gnu.org:


Received: (at 14109) by debbugs.gnu.org; 1 Apr 2013 16:41:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 01 12:41:34 2013
Received: from localhost ([127.0.0.1]:56234 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UMhnY-0000yA-Uc
	for submit <at> debbugs.gnu.org; Mon, 01 Apr 2013 12:41:33 -0400
Received: from world.peace.net ([96.39.62.75]:54956)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <mhw@HIDDEN>) id 1UMhnS-0000xy-Kq
	for 14109 <at> debbugs.gnu.org; Mon, 01 Apr 2013 12:41:29 -0400
Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com
	([209.6.91.212] helo=tines.lan)
	by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.72) (envelope-from <mhw@HIDDEN>)
	id 1UMhkW-0003tX-IX; Mon, 01 Apr 2013 12:38:24 -0400
From: Mark H Weaver <mhw@HIDDEN>
To: Ian Price <ianprice90@HIDDEN>
Subject: Re: bug#14109: No code for 'bytevector->string' and
	'string->bytevector'
References: <87li93uepl.fsf@HIDDEN> <87mwtibhho.fsf@HIDDEN>
Date: Mon, 01 Apr 2013 12:38:12 -0400
In-Reply-To: <87mwtibhho.fsf@HIDDEN> (Ian Price's message of "Mon, 01 Apr
	2013 12:46:59 +0100")
Message-ID: <87fvza2oln.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 14109
Cc: Nikita Karetnikov <nikita@HIDDEN>, 14109 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

Ian Price <ianprice90@HIDDEN> writes:

> Nikita Karetnikov <nikita@HIDDEN> writes:
>
>> The mentioned functions are documented [1].  However, I'll get the
>> "Unbound variable" error if I try to import them:
>>
>> scheme@(guile-user)> ,use (rnrs io ports) 
>> scheme@(guile-user)> string->bytevector
>> ;;; <unknown-location>: warning: possibly unbound variable `string->bytevector'
>> ERROR: In procedure #<procedure 8ab8bc0 ()>:
>> ERROR: In procedure module-lookup: Unbound variable: string->bytevector
>
> Even if they were available, it wouldn't do you much good, because the
> general transcoder functionality on ports isn't implemented.

Indeed, it would be good to implement this at some point.

> For the moment, the (rnrs bytevectors) module has string->utf8,
> string->utf16, and string->utf32 which are implemented. Though, this
> doesn't let you specify eol-style or handling-mode.

There's also Andy's shiny new (ice-9 iconv) module, which provides more
general iconv functionality and will make its debut in 2.0.8.  It
contains 'string->bytevector' and 'bytevector->string', though beware
that they're not the same as the R6RS procedures, despite their names.

These are documented in section 6.6.5.13 of the manual in stable-2.0,
but were not in the index due to some broken texinfo markup which I just
fixed.

      Mark


 -- Scheme Procedure: string->bytevector string encoding
          [conversion-strategy]
     Encode STRING as a sequence of bytes.

     The string will be encoded in the character set specified by the
     ENCODING string.  If the string has characters that cannot be
     represented in the encoding, by default this procedure raises an
     `encoding-error'.  Pass a CONVERSION-STRATEGY argument to specify
     other behaviors.

     The return value is a bytevector.  *Note Bytevectors::, for more on
     bytevectors.  *Note Ports::, for more on character encodings and
     conversion strategies.

 -- Scheme Procedure: bytevector->string bytevector encoding
          [conversion-strategy]
     Decode BYTEVECTOR into a string.

     The bytes will be decoded from the character set by the ENCODING
     string.  If the bytes do not form a valid encoding, by default this
     procedure raises an `decoding-error'.  As with
     `string->bytevector', pass the optional CONVERSION-STRATEGY
     argument to modify this behavior.  *Note Ports::, for more on
     character encodings and conversion strategies.

 -- Scheme Procedure: call-with-output-encoded-string encoding proc
          [conversion-strategy]
     Like `call-with-output-string', but instead of returning a string,
     returns a encoding of the string according to ENCODING, as a
     bytevector.  This procedure can be more efficient than collecting a
     string and then converting it via `string->bytevector'.




Information forwarded to bug-guile@HIDDEN:
bug#14109; Package guile. Full text available.

Message received at 14109 <at> debbugs.gnu.org:


Received: (at 14109) by debbugs.gnu.org; 1 Apr 2013 11:56:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 01 07:56:06 2013
Received: from localhost ([127.0.0.1]:55586 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UMdLF-0001ZR-PO
	for submit <at> debbugs.gnu.org; Mon, 01 Apr 2013 07:56:05 -0400
Received: from mail-wi0-f173.google.com ([209.85.212.173]:61795)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <ianprice90@HIDDEN>) id 1UMdL8-0001ZE-44
	for 14109 <at> debbugs.gnu.org; Mon, 01 Apr 2013 07:55:59 -0400
Received: by mail-wi0-f173.google.com with SMTP id ez12so1471630wid.12
	for <14109 <at> debbugs.gnu.org>; Mon, 01 Apr 2013 04:53:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=googlemail.com; s=20120113;
	h=x-received:from:to:cc:subject:references:date:in-reply-to
	:message-id:user-agent:mime-version:content-type;
	bh=n8/kBuHhkFhFGAv/y3COtx8rkU+9P5zuP+amk67qmz4=;
	b=d+KAa3FKTyv8LIeBYyjhgCXqe2Q7s2JfEF0SfViBI1RNveWrh+c6t+vovKHy5RtGKD
	akadryAsqf3IkSw/oBW4gEoq5kMsq8gpuMdvwg7pENvvufTZQXi4ZYyiTdUlaQoDiY6g
	su+ex2c9ii01QkwcSxfXrc38l0Tay6+kbdoGtdqYaYXLHJp6zyCk1JTO4jGltwbcLlav
	6WFNmR4Vh4rzCRMtAPo12kv19Iv0ZzYpmn4es+63NqT3vMqL0co9AVNmhQrfsa87KxeN
	YWSrqYUDfxv/ZYE9Qm60NrGYDw9d2TA5Dgx5ZFfiPemn3Q/X/0/+4EtcPA3B78VrcX9Y
	3KIQ==
X-Received: by 10.180.14.129 with SMTP id p1mr9492566wic.1.1364816824797;
	Mon, 01 Apr 2013 04:47:04 -0700 (PDT)
Received: from Kagami.home (host31-53-168-237.range31-53.btcentralplus.com.
	[31.53.168.237])
	by mx.google.com with ESMTPS id bk1sm14503260wib.2.2013.04.01.04.47.02
	(version=TLSv1.2 cipher=RC4-SHA bits=128/128);
	Mon, 01 Apr 2013 04:47:03 -0700 (PDT)
From: Ian Price <ianprice90@HIDDEN>
To: Nikita Karetnikov <nikita@HIDDEN>
Subject: Re: bug#14109: No code for 'bytevector->string' and
	'string->bytevector'
References: <87li93uepl.fsf@HIDDEN>
Date: Mon, 01 Apr 2013 12:46:59 +0100
In-Reply-To: <87li93uepl.fsf@HIDDEN> (Nikita Karetnikov's message of
	"Mon, 01 Apr 2013 07:12:06 +0400")
Message-ID: <87mwtibhho.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-2022-jp
X-Spam-Score: 0.4 (/)
X-Debbugs-Envelope-To: 14109
Cc: 14109 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.3 (--)

Nikita Karetnikov <nikita@HIDDEN> writes:

> The mentioned functions are documented [1].  However, I'll get the
> "Unbound variable" error if I try to import them:
>
> scheme@(guile-user)> ,use (rnrs io ports) 
> scheme@(guile-user)> string->bytevector
> ;;; <unknown-location>: warning: possibly unbound variable `string->bytevector'
> ERROR: In procedure #<procedure 8ab8bc0 ()>:
> ERROR: In procedure module-lookup: Unbound variable: string->bytevector

Even if they were available, it wouldn't do you much good, because the
general transcoder functionality on ports isn't implemented.

e.g.
scheme@(guile−user)> (open-bytevector-input-port
                       (string->utf8 "foobarbaz")
                       (make-transcoder (utf-8-codec)))
GNU Guile: warning: transcoders not implemented
$5 = #<input: r6rs−bytevector−input−port ae46b40>

Maybe we could stub these, since they are mentioned in the info file[0],
and warn about them not being implemented like we do e.g. with
open-bytevector-input-port.

For the moment, the (rnrs bytevectors) module has string->utf8,
string->utf16, and string->utf32 which are implemented. Though, this
doesn't let you specify eol-style or handling-mode.

0. This documentation is lifted straight from the R6RS (modulo
formatting).
-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"




Information forwarded to bug-guile@HIDDEN:
bug#14109; Package guile. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Apr 2013 04:38:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 01 00:38:11 2013
Received: from localhost ([127.0.0.1]:55170 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UMWVW-00062f-E1
	for submit <at> debbugs.gnu.org; Mon, 01 Apr 2013 00:38:10 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60429)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <nikita@HIDDEN>) id 1UMVBo-000420-MY
	for submit <at> debbugs.gnu.org; Sun, 31 Mar 2013 23:13:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <nikita@HIDDEN>) id 1UMV90-0002Uu-FG
	for submit <at> debbugs.gnu.org; Sun, 31 Mar 2013 23:10:53 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_MIME_NO_TEXT
	autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:35059)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <nikita@HIDDEN>) id 1UMV90-0002Up-9P
	for submit <at> debbugs.gnu.org; Sun, 31 Mar 2013 23:10:50 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43548)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <nikita@HIDDEN>) id 1UMV8s-00012C-J5
	for bug-guile@HIDDEN; Sun, 31 Mar 2013 23:10:50 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <nikita@HIDDEN>) id 1UMV8m-0002U6-Et
	for bug-guile@HIDDEN; Sun, 31 Mar 2013 23:10:42 -0400
Received: from li305-5.members.linode.com ([178.79.168.5]:41237
	helo=cooksoni.karetnikov.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <nikita@HIDDEN>) id 1UMV8m-0002Tz-9K
	for bug-guile@HIDDEN; Sun, 31 Mar 2013 23:10:36 -0400
From: Nikita Karetnikov <nikita@HIDDEN>
To: bug-guile@HIDDEN
Subject: No code for 'bytevector->string' and 'string->bytevector'
Date: Mon, 01 Apr 2013 07:12:06 +0400
Message-ID: <87li93uepl.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
	micalg=pgp-sha1; protocol="application/pgp-signature"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -4.2 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Mon, 01 Apr 2013 00:38:08 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

--=-=-=
Content-Transfer-Encoding: quoted-printable

The mentioned functions are documented [1].  However, I'll get the
"Unbound variable" error if I try to import them:

scheme@(guile-user)> ,use (rnrs io ports)=20
scheme@(guile-user)> string->bytevector
;;; <unknown-location>: warning: possibly unbound variable `string->bytevec=
tor'
ERROR: In procedure #<procedure 8ab8bc0 ()>:
ERROR: In procedure module-lookup: Unbound variable: string->bytevector

(I haven't found them via 'grep' too.)

I'm using Guile 2.0.7.

[1] https://gnu.org/software/guile/manual/guile.html#R6RS-Transcoders

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQIcBAEBAgAGBQJRWPtDAAoJEM+IQzI9IQ38O8wP/30dfU8loPxs9W5BF3A/5TWP
Wb7R1gBGcy7vLQK6FCU4han3plBeFrbNLf+M6LJKK4TUn5y+6zeSG5IKw315vS1x
0v/tJsjjwerKTwEwiNbvwAHUtHsGwNIBS+WkNMD2+JIr/dOTbphHw0J/lmE6uRiE
eyzqyi0xV3XQobsRNjlGUY4m6Mtco9VomIjCdMJ4LIm1jUfdiY3+Pj87QkOzfl09
ERAKyiNDybjE4fhSPoN9zPGUOAP1XQAF4sromksOIb2hP5aUkkqjJHYsKcco83j/
shYtV/badlAVqS/4JvyNUgPqopUvu6SaNettUjp6NDcEqE5eU6jLBHmFjlz/2vdI
Vx4vG2NvkBIyBZrl73ejpPVecbycy9JwE6G8T32PD2rW3bcX83YbEFNKqk/kLWsl
ghuVNRhRJpergibunYg2iVC1rlmI0a9tmQ3NYTG8vWJL1sTWBs6m9tGQhu90kiRL
+8j5ox5jxp/wfmGPGfSc1RxwQ59k6VN6cLKOcK1/DjD54EzXLzUu2krMiVMgmAze
KK49KncmMh991eUcF9w+hB0OIp/XLirIfEmVQKke9uGtIO++97+kb8FDMD4+F4c6
PFxTbIZcowHlxaClO7qpoWZDu1WdpYpOpH32jCXmfCYsVvL8jKNM+CsMdK4Y49nR
4no6vGjNnS6mJMXAH96Q
=Jop7
-----END PGP SIGNATURE-----
--=-=-=--




Acknowledgement sent to Nikita Karetnikov <nikita@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#14109; Package guile. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.