vtemian / buffpy

Simple to use python library for Buffer App
MIT License
23 stars 29 forks source link

Problems with some unicode characters? #11

Closed fernand0 closed 5 years ago

fernand0 commented 9 years ago

Hello,

I'm using buffpy to update my buffer and I've found problems when tryint to put this string: u"Why Today’s Security Measures Just Don’t Cut It." The problematic character seems to be the Unicode Character 'RIGHT SINGLE QUOTATION MARK' (U+2019) which appears twice in this string.

Looking at the code, it seems to be using unicode, but when passing the parameters to the oauth module (in api.py, line: response = self.session.post(url=BASE_URL % url, headers=headers, **params) text in params ('data', in particular) is unicode and the module (at least in my computer) seems to be expecting strings. I've put before this line, the following one: params['data'] = str(params['data']) response = self.session.post(url=BASE_URL % url, headers=headers, **params) and everything seems to be working ok.

Maybe I'm completely wrong because I'm not very good at the particularities of unicode and string chars in Python, or the configuration of my system is not ok, but I wanted to check it here and give you a big thank you for the project.

Thanks.

vtemian commented 5 years ago

In 3.X we'll be dropping the support for python 2.7 and move to python 3.6. This should solve the unicode problem, but we'll need to add a test for it.

vtemian commented 5 years ago

I've added some tests with emojis and it should be fine now. https://github.com/vtemian/buffpy/commit/72010f8abdc569c7573f17a6026131417bbd91c6