sb-impl:read-from-c-string/* report undecodable octets incorrectly

Bug #710626 reported by 3b
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Medium
Unassigned

Bug Description

(cffi:with-foreign-string (a (string (code-char #xff)) :encoding :iso-8859-1)
  (sb-impl::read-from-c-string/ascii a 'character))

gives the error:

c-string decoding error (:external-format :ASCII):
  the octet sequence 1 cannot be decoded.
   [Condition of type SB-INT:C-STRING-DECODING-ERROR]

expected something describing the octets that could not be decoded (#xff in this case) rather than always 1

(cffi:with-foreign-string (a (string (code-char #xff)) :encoding :iso-8859-1)
  (sb-impl::read-from-c-string/utf-8 a 'character))

produces
c-string decoding error (:external-format :UTF-8):
  the octet sequence 4 cannot be decoded.
   [Condition of type SB-INT:C-STRING-DECODING-ERROR]

the '4' in the error message varies from 1 to 4 depending on the octet sequence, but still doesn't not show the actual octets

tested on "1.0.45.13", x8664 linux

Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

Looks like there's confusion re. meaning of DECODE-BREAK-REASON in the source.

Changed in sbcl:
importance: Undecided → Medium
status: New → Triaged
tags: added: external-formats
Revision history for this message
Douglas Katzman (dougk) wrote :

This was fixed sufficiently long ago that I don't know when.
It now prints:

#<THREAD "main thread" RUNNING {D8E6F0C9}>:
  :ASCII c-string decoding error: the octet sequence #(255) cannot be decoded.

Changed in sbcl:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.