more about build-index+cl-ppcre branch & encodings



It would require implementation specific support but there is already the 'octets-to-string function within src/intl.lisp.

The SCL can use the following to position to the byte-offset and then read characters:
    (with-open-file (bin path+filename :direction :input :element-type '(unsigned-byte 8))
       (file-position bin byte-offset)
       (let ((in (ext:make-character-conversion-stream bin :input t)))
	(read-sequence text in :start 0 :end byte-count)))

Regards
Douglas Crosher

On 03/03/11 17:18, Robert Dodier wrote:
> On 3/2/11, Douglas Crosher<dtc-maxima at scieneer.com>  wrote:
>
>> Needless to say the use of a character offset for the Maxima info documents
>> suits the SCL, but it could also work with byte offsets,
> [...]
>> just reading a chunk of bytes and converting them to characters.
>
> How can that be implemented? Is there a CL function for it?
> I don't think CODE-CHAR is enough, and I don't know anything else to try.
>
> best
>
> Robert Dodier
>