bugMIT/GNU Scheme - Bugs: bug #58893, read-xml-file fails with files...

 
 

bug #58893: read-xml-file fails with files that are not Unicode NFC-encoded

Submitter:  Arthur A. Gleckler <aag>
Submitted:  Mon 03 Aug 2020 07:03:37 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  cph Originator Name: 
Open/Closed:  Closed
Keywords: 
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 22 Feb 2021 07:16:19 AM UTC, comment #2: 

This should be fixed now on HEAD. Please confirm.

Chris Hanson <cph>
Group administrator
Mon 03 Aug 2020 07:10:03 PM UTC, comment #1: 

P.S.: Here's a simple workaround, but it requiring loading the whole XML file into memory:


(open-input-string (string->nfc (read-entire-file pathname)))


read-entire-file simply loads the entire file into memory as a string.

Arthur A. Gleckler <aag>
Group Member
Mon 03 Aug 2020 07:03:37 PM UTC, original submission:  

Given a file that is not NFC-encoded, this expression fails:

(read-xml-file "/tmp/reproduce.xml")
;The object "\nx xxxxxxx xxxxxx xx xxxx xxxxxx xx xxxx xxxxxx xx xx xxxxx xxxx, <x>xxx xxx xx xxxxx,</x> xxx xx xxxxxxxx xx xxx xxxxxxx xxx xxx xxxxxxx. xxx “xxx xx xxxxx” xxx xxxx xxxx xxx xxxxxx xxxxx xxxx xxxx xxxxx. x xxx xxxxx xx xx xxxxx xxxx xxxxxxxxxxx xxxx xxx xxxxx xx xxxxxxxxxx xxxxxxx xxx xxxxxxxx xx xxx’x xxx xxxxxxxxxxxxx. xxx xxxx xxxx xx xxxxxxxxxxx xxxx xxx xxxxx xx xxxxxxxxxx xxxx xxxxx xx xxxxxxxxxxxxx xxxx, xx xxxxxxxx xxxxxxx, xxxxxxxxxxx xxx xx xxx xxxxx xxxxx xxxxxxxx xx xxx xxxx. (xxx ...", passed as an argument to string-find-first-index, is not the correct type.
;To continue, call RESTART with an option number:
; (RESTART 1) => Return to read-eval-print level 1.

2 error>

I've attached the offending file, which was part of a podcast feed.  In order to avoid copyright issues, I've replaced [a-zA-Z] with "x" throughout the textual content.

read-xml-file reads the same file file after normalization using Emacs's ucs-normalize-NFC-region.

Arthur A. Gleckler <aag>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #49620:  reproduce.xml added by aag (24KiB - text/xml)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by cph (Posted a comment)
  • -email is unavailable- added by aag (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-02-22 aag Open/ClosedOpen Closed
    2021-02-22 cph StatusNone Fixed
        Assigned toNone cph
    2020-08-03 aag Attached File- Added reproduce.xml, #49620

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code