--- Begin Message ---
Subject: |
string->bytevector encoding error |
Date: |
Sun, 14 Feb 2016 23:18:16 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
'string->bytevector' throws 'encoding-error' when the encoding is
"UTF-16" and the length of the string is greater than 128. The same
for the encoding "UTF-32" and a string of length greater than 64.
Tested on Guile 2.0.11 and 2.1.2 with the same result.
How to reproduce:
(use-modules (ice-9 iconv))
;; These expressions evaluate as expected:
(string->bytevector (make-string 128 #\A) "UTF-16")
;; => #vu8(254 255 0 65 0 65 ...)
(string->bytevector (make-string 64 #\A) "UTF-32")
;; => #vu8(0 0 254 255 0 0 0 65 0 0 0 65 ...)
;; These expressions throw 'encoding-error':
(string->bytevector (make-string 129 #\A) "UTF-16")
(string->bytevector (make-string 65 #\A) "UTF-32")
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#22667: string->bytevector encoding error |
Date: |
Sun, 07 Aug 2016 23:25:29 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Hi,
On Mon 20 Jun 2016 18:07, Andy Wingo <address@hidden> writes:
> On Sun 14 Feb 2016 23:18, Josep Portella Florit <address@hidden> writes:
>
>> (use-modules (ice-9 iconv))
>> ;; These expressions throw 'encoding-error':
>> (string->bytevector (make-string 129 #\A) "UTF-16")
>> (string->bytevector (make-string 65 #\A) "UTF-32")
>
> For what it's worth, this appears to be fixed in 2.1.3. However we
> should fix 2.0 as well.
Fixed. Thanks for the report, and thanks to Mark for diagnosing the
problem.
Andy.
--- End Message ---