NZB content encoding causes error

Report & discuss bugs found in SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
dzm06
Newbie
Newbie
Posts: 3
Joined: August 13th, 2009, 5:27 pm

NZB content encoding causes error

Post by dzm06 »

And NZB file I downloaded was being rejected with:

2009-08-13 13:47:09,331::INFO::[sabnzbd] Adding FOO.nzb
2009-08-13 13:47:09,350::INFO::[nzbstuff] Replacing spaces with underscores in FOO
2009-08-13 13:47:09,431::WARNING::[nzbstuff] Incorrect NZB file FOO.nzb (trying anyway)
2009-08-13 13:47:09,433::ERROR::[nzbstuff] Invalid NZB file FOO.nzb, skipping

After much poking about I discovered that the rejection was due to the encoding specified in the NZB file. Changing it from UTF-8 to ISO-8899-1 made everything happy. The ONLY difference between Working and Not Working is the encoding set in the file:

# diff ~/FOO_orig.nzb ~/FOO_new.nzb
1c1

---
>
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: NZB content encoding causes error

Post by switch »

Please could you email the nzb and the details of the site you got it from to [email protected] so we can look into this further.

This could be the fault of the nzb site, and not us. Also we can check with the upcoming version 0.5 as that features a whole new nzb parsing implementation.
dzm06
Newbie
Newbie
Posts: 3
Joined: August 13th, 2009, 5:27 pm

Re: NZB content encoding causes error

Post by dzm06 »

Hmm. I may have spoken too soon. The file is not rejected, but the download doesn't happen either.

Emailing details as requested. Thanks!
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: NZB content encoding causes error

Post by switch »

Well the nzb cannot be parsed under the latest internal build of 0.5.

One of the standard python parsers (xml.sax) refuses to parse line 1595 which contains the section sign character (§).

The exact error message is "not well-formed (invalid token)".

The input of the nzb probably needs to be converted to utf-8 first to be processed correctly, however I am no expert in character encoding so I will have to leave it up to one of the other members of the team for their input; and what can be done to fix it.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: NZB content encoding causes error

Post by shypike »

I have looked at the NZB file.
It contains an incorrect character "§", which cannot be represented like this in UTF-8 encoding.
To put simply: it's a badly formatted XML file (NZB is XML-encoded).
Please complain to tvnzb.com, they should know they must generate correct files.

Compensating for this would mean lots of extra coding effort on our side
since we would no longer be able to use a standard XML handler.
We will not put effort in this just to compensate for the sloppy ways of some NZB sites.
Last edited by shypike on August 15th, 2009, 7:06 am, edited 1 time in total.
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: NZB content encoding causes error

Post by switch »

The nzb was generated using newsleecher, so it is probably also worth letting them know about this bug. (This is addressed to dzm06 or anyone else)
dzm06
Newbie
Newbie
Posts: 3
Joined: August 13th, 2009, 5:27 pm

Re: NZB content encoding causes error

Post by dzm06 »

Thanks much for looking into the problem.
Post Reply