google-code-export / fanficdownloader

Automatically exported from code.google.com/p/fanficdownloader
0 stars 0 forks source link

Crashes on fanfiction.net (probably only on chapters with EN DASH in their title) #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Run the command:
python downaloder.py 
http://www.fanfiction.net/s/2120109/1/Harry_Potter_and_the_Dormant_Power epub

What is the expected output? What do you see instead?
The above command gives the error:
Traceback (most recent call last):
  File "downaloder.py", line 112, in <module>
    loader.download()
  File "downaloder.py", line 50, in download
    urls = self.adapter.extractIndividualUrls()
  File "/Users/mitchell/Code/fanficdownloader/ffnet.py", line 102, in extractIndividualUrls
    u = l.decode('utf-8')
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 
210: ordinal not in range(128)

What version of the product are you using? On what operating system?
Revision 54fc9b30ce on Mac OSX 10.6

Please provide any additional information below.
I am not sure if this is correct, but replacing line 102 of ffnet.py, currently:
u = l.decode('utf-8')
with this:
u = l
try:
  u = l.decode('utf-8')
except:
  pass

appears to fix the issue

Original issue reported on code.google.com by knightqu...@gmail.com on 17 Aug 2010 at 2:31

GoogleCodeExporter commented 9 years ago
Fixed in the most recent version.

Original comment by retiefj...@gmail.com on 16 Oct 2010 at 1:51