[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #8265 [Stem]: UnicodeEncodeError: 'ascii' codec can't encode character u'\xab' in position 950: ordinal not in range(128)
#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
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs