-
Notifications
You must be signed in to change notification settings - Fork 3
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
Ensure UTF8 encoding #7
Conversation
Avoid future problems with database fields encoded with latin1 and other codifications. This fixes a livestatus error (shinken-monitoring/mod-livestatus#33) creating a response with fields imported with this module encoded as latin1.
Thanks! Same suggestion for this module about tests :) |
Hi, I'm not ok with this patch. It import chardet that is not a default module. It add a new dep for a very specific case. So it should be at least optional and called only if need, and if possible avoid even with a new module parameter (like let the user set the charset if it's not utf8 for example). |
@@ -30,6 +30,8 @@ | |||
except ImportError: | |||
MySQLdb = None | |||
|
|||
import chardet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PB here :)
I didn't know that chardet isn't a default module although is installed in all my systems without extra actions. Sorry about that. In that case @naparuba, I should have check if chardet is installed before using it. Check out the following patch: I can prepare a new pull request if you want. |
Thanks :) On Mon, Sep 29, 2014 at 1:28 PM, David Gil [email protected] wrote:
|
The use of chardet python library is quite useful in order to detect character encodings, but it's not installed in all systems by default. So, it's a good practice to check its availability before using it. This pull request enhances shinken-monitoring#7
Avoid future problems with database fields encoded with latin1 and other codifications. This fixes a livestatus error (shinken-monitoring/mod-livestatus#33) creating a livestatus response with fields imported with this module encoded as latin1.