Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal UnicodeEncodeError during warning reporting #22

Open
simevo opened this issue May 15, 2015 · 1 comment
Open

fatal UnicodeEncodeError during warning reporting #22

simevo opened this issue May 15, 2015 · 1 comment

Comments

@simevo
Copy link

simevo commented May 15, 2015

We were migrating some markdown from a wiki. There are stray references we are in the process of converting manually. One of them ([[kkkk©|kkkk]]) caused an unrecoverable UnicodeEncodeError:

paolog@matanui:/tmp/qq$ urubu build
Traceback (most recent call last):
...
  File "/usr/local/lib/python2.7/dist-packages/urubu/md_extensions.py", line 110, in handleMatch
    warn(undef_ref_warning.format(ref, this['fn']), UrubuWarning)
  File "/usr/lib/python2.7/warnings.py", line 29, in _show_warning
    file.write(formatwarning(message, category, filename, lineno, line))
  File "/usr/lib/python2.7/warnings.py", line 38, in formatwarning
    s =  "%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa9' in position 20: ordinal not in range(128)

This makes the actual source of the problem difficult to find. I believe you should use string.text.encode('ascii', 'ignore') somewhere.

BTW great tool thanks for sharing.

@ristkof
Copy link

ristkof commented Aug 25, 2016

@jandecaluwe I ran into a similar issue today. I fixed it by adding

import sys
reload(sys)
sys.setdefaultencoding('utf-8')

in project.py and in processors.py. This piece of code came up as a solution on stackoverflow

The reason was that I had an 'ó' in a post title.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants