test locale for Unicode support
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pastebinit |
Fix Released
|
Medium
|
Unassigned | ||
pastebinit (Ubuntu) |
Fix Released
|
Low
|
Unassigned |
Bug Description
pastebinit needs Unicode support to work. It would be nice if it tested for it and raised an error understandable to the average user.
$ LC_ALL=C.UTF-8 pastebinit -v
pastebinit v1.4
$ LC_ALL=C.UTF-8 pastebinit -v
pastebinit v1.4
leggewie@
Traceback (most recent call last):
File "/usr/bin/
pastebind = preloadPastebins()
File "/usr/bin/
instance.
File "/usr/lib/
self._read(fp, filename)
File "/usr/lib/
for lineno, line in enumerate(fp, start=1):
File "/usr/lib/
return codecs.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 167: ordinal not in range(128)
Changed in pastebinit: | |
status: | Fix Committed → Fix Released |
I pushed two commits that should improve this quite a bit.
1) pastebinit will now ignore any pastebin configuration file it can't read because of encoding errors (in this case, the Chinese Ubuntu pastebin contained utf-8 characters for the submit button).
2) pastebinit will now read input files in raw byte mode and not attempt decoding, so it can submit utf-8 encoded files even if it's not itself running under an utf-8 locale
I won't however add a specific check for an utf-8 locale because while that's easy to do on Linux, it's not so much easy when you also need to support Windows, MacOS, ...