theslavicbear / Ebook-Publisher

A Python tool for converting online stories into portable formats
MIT License
32 stars 2 forks source link

Chyoa - UnicodeEncodeError #61

Closed SomeRandomDude870 closed 3 years ago

SomeRandomDude870 commented 4 years ago

Hi, I get here for some stories with txt,html and epub and error. epub and html will be produced normally, but Text files will throw this error and the txt file will only contain the Story- and author name.

Traceback (most recent call last): File "Ebook-Publisher.py", line 295, in <module> formats[ft](clas) File "Ebook-Publisher.py", line 33, in <lambda> 'html':lambda x:MakeHTML(x), File "Ebook-Publisher.py", line 81, in MakeHTML published.write('<h2 id = "'+site.depth[i-1]+'">'+site.chapters[i]+'\n</h2>\n'+str(site.rawstoryhtml[i])) File "C:\myProgramme\Python\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u202d' in position 512: character maps to <undefined>

theslavicbear commented 4 years ago

Can you share one or more URLs that cause this error? Otherwise I'll need to check every character encoding method (which I should probably do anyway).

SomeRandomDude870 commented 4 years ago

hmmm I had yesterday several that threw me an error, now I can only find one out of ten. https://chyoa.com/chapter/Introduction.235306

theslavicbear commented 4 years ago

I have this one working fine for me. I'll have to try this on Windows to see if it works differently.

SomeRandomDude870 commented 4 years ago

Just downloaded it, same error.

theslavicbear commented 3 years ago

I set encoding to UTF-8 in most recent commit, request you to pull latest code and try running again.