[tor-bugs] #8265 [Stem]: UnicodeEncodeError: 'ascii' codec can't encode character u'\xab' in position 950: ordinal not in range(128)
Tor Bug Tracker & Wiki
blackhole at torproject.org
Sun Feb 17 20:47:08 UTC 2013
#8265: UnicodeEncodeError: 'ascii' codec can't encode character u'\xab' in
position 950: ordinal not in range(128)
---------------------+------------------------------------------------------
Reporter: gsathya | Owner: atagar
Type: defect | Status: needs_information
Priority: normal | Milestone:
Component: Stem | Version:
Keywords: | Parent:
Points: | Actualpoints:
---------------------+------------------------------------------------------
Changes (by atagar):
* status: new => needs_information
Comment:
Hi Sathyanarayanan. The contact address is parsed by stem as a unicode
string. It can be printed, you just need to be careful because str() will
fail to convert it...
{{{
>>> from stem.descriptor import parse_file
>>> with open('desc.txt') as descriptor_file:
... desc = next(parse_file(descriptor_file))
...
>>> desc.contact
u'1024D/070E3F2D Marcus Griep \xabtormaster%xpdm%us\xbb'
>>> print desc.contact
1024D/070E3F2D Marcus Griep «tormaster%xpdm%us»
>>> str(desc.contact)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xab' in
position 28: ordinal not in range(128)
}}}
Did you have any other questions?
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/8265#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list