projectgus / yamdwe

Yet Another Mediawiki to DokuWiki Exporter
Other
24 stars 12 forks source link

The problem of coverting filename with the Chinese character #49

Open mintow opened 6 years ago

mintow commented 6 years ago

My MediaWiki has so many pages with Chinese character. Running yamdwe.py, and I got an error:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 5: ordinal not in range(128)

I added some code as follow: dokuwiki.py about L87 full_title = full_title.decode('utf-8') wikicontent.py about L180 pagename = pagename.decode('utf-8') text = text.decode('utf-8')

And I got another error:

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

I think it's because of the Chinese character in pagename/titlename. I also failed when replace the decode() with urllib.quote(), Do you have any other suggestions?