1 Return-Path: <tomi.ollila@iki.fi>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id A87E3431FBD
\r
6 for <notmuch@notmuchmail.org>; Tue, 4 Feb 2014 10:40:28 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id tTb7boxQsUGJ for <notmuch@notmuchmail.org>;
\r
16 Tue, 4 Feb 2014 10:40:23 -0800 (PST)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id A8F0F431FBC
\r
19 for <notmuch@notmuchmail.org>; Tue, 4 Feb 2014 10:40:23 -0800 (PST)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id 187C6100033;
\r
22 Tue, 4 Feb 2014 20:40:19 +0200 (EET)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: "W. Trevor King" <wking@tremily.us>
\r
25 Subject: Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general
\r
27 In-Reply-To: <20140204161142.GS14197@odin.tremily.us>
\r
28 References: <cover.1391424512.git.wking@tremily.us>
\r
29 <m2ha8frjgg.fsf@guru.guru-group.fi>
\r
30 <20140204005331.GQ14197@odin.tremily.us>
\r
31 <m2fvnzp3uh.fsf@guru.guru-group.fi>
\r
32 <20140204161142.GS14197@odin.tremily.us>
\r
33 User-Agent: Notmuch/0.17+55~g4397960 (http://notmuchmail.org) Emacs/24.3.1
\r
34 (x86_64-unknown-linux-gnu)
\r
35 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
36 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
37 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
38 Date: Tue, 04 Feb 2014 20:40:18 +0200
\r
39 Message-ID: <m2a9e6zppp.fsf@guru.guru-group.fi>
\r
41 Content-Type: text/plain; charset=utf-8
\r
42 Content-Transfer-Encoding: quoted-printable
\r
43 Cc: notmuch@notmuchmail.org
\r
44 X-BeenThere: notmuch@notmuchmail.org
\r
45 X-Mailman-Version: 2.1.13
\r
47 List-Id: "Use and development of the notmuch mail system."
\r
48 <notmuch.notmuchmail.org>
\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
52 List-Post: <mailto:notmuch@notmuchmail.org>
\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
56 X-List-Received-Date: Tue, 04 Feb 2014 18:40:28 -0000
\r
58 On Tue, Feb 04 2014, "W. Trevor King" <wking@tremily.us> wrote:
\r
61 > >>> from __future__ import unicode_literals
\r
65 > >>> print(locale.getpreferredencoding()) # same as yours
\r
67 > >>> print(sys.getdefaultencoding()) # same as yours
\r
69 > >>> _ENCODING =3D locale.getpreferredencoding() or sys.getdefaultencodi=
\r
71 > >>> print(_ENCODING) # double-check default encodings
\r
73 > >>> byte_stream =3D sys.stdout # copied from Page.write
\r
74 > >>> stream =3D codecs.getwriter(encoding=3D_ENCODING)(stream=3Dbyte_str=
\r
76 > >>> data =3D {'from': '\u017b'} # fake the troublesome data
\r
77 > >>> print(type(data['from'])) # double-check unicode_literals
\r
79 > >>> string =3D ' <td>{from}</td>\n'.format(**data)
\r
80 > >>> stream.write(string)
\r
83 > It looks like you'll have the same _ENCODING as I do (UTF-8). That
\r
84 > means your stream should be wrapped in a UTF-8 StreamWriter, so I
\r
85 > don't understand why it's converting to ASCII. Can you run through
\r
86 > the above on your troublesome machine and confirm that stream.write()
\r
87 > is still raising the exception? If it doesn't work, can you just
\r
88 > paste that whole run in your next email?
\r
90 I don't know what to paste, so i paste this:
\r
93 Python 2.6.6 (r266:84292, Nov 21 2013, 12:39:37)=20
\r
94 [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
\r
95 Type "help", "copyright", "credits" or "license" for more information.
\r
96 >>> data =3D {'from': '\u017b'}
\r
97 >>> print(type(data['from']))=20
\r
99 >>> string =3D ' <td>{from}</td>\n'.format(**data)
\r
105 >>> data =3D {'from': u'\u017b'}
\r
106 >>> print(type(data['from']))=20
\r
108 >>> string =3D ' <td>{from}</td>\n'.format(**data)
\r
109 Traceback (most recent call last):
\r
110 File "<stdin>", line 1, in <module>
\r
111 UnicodeEncodeError: 'ascii' codec can't encode character u'\u017b' in
\r
112 >>> position 0: ordinal not in range(128)
\r
117 >>> print os.environ['LANG']
\r