Sabnzbd cannot handle non ASCII characters on ASCII file
Posted: June 12th, 2024, 4:36 am
Some indexers, or even ngPost may produce ASCII nzb, but it contains some special characters or any unicode letter, it would throw"not well-formed" error message
I did fix this by using python script, but if python script can do it, then sabnzbd can do it better and auto detect the file encoding and try to parse it as utf-8 file.
This is the script I use to fix those "not well-formed" nzb files.
I did fix this by using python script, but if python script can do it, then sabnzbd can do it better and auto detect the file encoding and try to parse it as utf-8 file.
This is the script I use to fix those "not well-formed" nzb files.
Code: Select all
import pathlib
files = list(pathlib.Path().rglob('*.nzb'))
fileslist = []
for item in files:
if item.is_file():
fileslist.append(item)
print(fileslist)
for file in fileslist:
try:
with open(file, 'r', encoding='ansi') as f:
text = f.read()
with open(file, 'w', encoding='utf8') as f:
f.write(text)
except:
pass