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

UnicodeEncodeError in text._gen_at_message function #40

Open
he2ss opened this issue Jun 2, 2017 · 0 comments
Open

UnicodeEncodeError in text._gen_at_message function #40

he2ss opened this issue Jun 2, 2017 · 0 comments

Comments

@he2ss
Copy link

he2ss commented Jun 2, 2017

Hello,

Thank you for this great lib.

I have this issue when the function _get_at_message return the text :

File "/home/hess/projects/venv/local/lib/python2.7/site-packages/mattermost_bot/dispatcher.py", line 195, in _gen_at_message
    return '@{}: {}'.format(self.get_username(), text)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in position 33: ordinal not in range(128)

I don't know why, but the content of "text" variable isn't encode in utf-8.
To fix this issue, text variable should be encoded in utf-8

    def _gen_at_message(self, text):
        return '@{}: {}'.format(self.get_username(), text.encode('utf-8'))
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

1 participant