Skip to content

"Invalid XML encountered": control characters in XML #626

@epilys

Description

@epilys
  • vdirsyncer version: 0.15.0
  • server: owncloud 8.2.2 (has sabre 2.1.7)
  • Python version: 3.6
  • Your operating system: openbsd 6.1
  • Your config file: not applicable

So I got this error:
error: The server returned something vdirsyncer doesn't understand. Error message: InvalidXMLResponse('Invalid XML encountered: not well-formed (invalid token): line 430, column 21\nDouble-check the URLs in your config.',)

Running --verbosity=DEBUG and looking at this line in the returned XML, I find this (censored) event:

<cal:calendar-data>BEGIN:VCALENDAR 
debug: VERSION:2.0                                                                             
debug: PRODID:ownCloud Calendar                                                                
 debug: CALSCALE:GREGORIAN                                                                      
 debug: BEGIN:VEVENT                                                                            
 debug: UID:<censored>                                                                          
 debug: DTSTAMP:<censored>                                                              
 debug: CREATED:<censored>                                                                     
 debug: LAST-MODIFIED:<censored>                                                               
 debug: SUMMARY:<censored>                                                            
 debug: DTSTART;TZID=<censored>                                                   
 debug: DTEND;TZID=<censored>                                                     
 debug: LOCATION:                                                                               
 debug: DESCRIPTION:<censored>^D<censored>                                  
 debug: CATEGORIES:                                                                             
 debug: END:VEVENT                                                                              
 debug: END:VCALENDAR                                                                           
 debug: </cal:calendar-data>

A stray ^D char in the DESCRIPTION field (how did it get there?). is returned. Other clients (owncloud web client, thunderbird lightning) don't throw an error at this.

Running sync again...:
error: The server returned something vdirsyncer doesn't understand. Error message: InvalidXMLResponse('Invalid XML encountered: not well-formed (invalid token): line 1189, column 21\nDouble-check the URLs in your config.',)

Now what?

...
1189: debug: SUMMARY:<censored>^O
...

Ugh! And not only 1189, but a lot of other events had stray ^Ds and ^Os. Turns out copying text from pdfs leaks control characters in your calendar, who knew. Removing those characters from the events allowed me to finally sync.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions