[PATCH v2 14/20] nmbug-status: Encode output using the user's locale

David Bremner david at tethera.net
Tue Feb 11 04:12:41 PST 2014


"W. Trevor King" <wking at tremily.us> writes:

> Instead of always writing UTF-8, allow the user to configure the
> output encoding using their locale.  This is useful for previewing
> output in the terminal, for poor souls that don't use UTF-8 locales
> ;).

This (or some other patch in the series) seems to cause some problems on
the production instance:

remote: Traceback (most recent call last):
remote:   File "/home/nmbug/tools/nmbug-status", line 336, in <module>
remote:     page.write(database=db, views=config['views'])
remote:   File "/home/nmbug/tools/nmbug-status", line 96, in write
remote:     self._write_view(database=database, view=view, stream=stream)
remote:   File "/home/nmbug/tools/nmbug-status", line 115, in _write_view
remote:     self._write_threads(threads=threads, stream=stream)
remote:   File "/home/nmbug/tools/nmbug-status", line 219, in _write_threads
remote:     ).format(**message_display_data))
remote:   File "/usr/lib/python2.6/codecs.py", line 351, in write
remote:     data, consumed = self.encode(object, self.errors)
remote: UnicodeEncodeError: 'ascii' codec can't encode character u'\u017b' in position 219: ordinal not in range(128)

possibly because of

LANG=C
LANGUAGE=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=C

I think it's fine to _allow_ the user to configure the output encoding. I'm
less sure about _requiring_ it.

d


More information about the notmuch mailing list