postoditacco / friendfeed-api

Automatically exported from code.google.com/p/friendfeed-api
0 stars 0 forks source link

Python module example function needs to print encodings correctly #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try running the friendfeed.py as is.
2. If one of the entries has a title that is not ascii, then you get the
famous unicode error.
3.

What is the expected output? What do you see instead?

The expected output is that you see the characters
properly encoded.

prompt> python friendfeed.py 
04/12/2008 Traceback (most recent call last):
  File "friendfeed.py", line 303, in <module>
    _example()
  File "friendfeed.py", line 275, in _example
    print entry["published"].strftime("%m/%d/%Y"), entry["title"]
UnicodeEncodeError: 'ascii' codec can't encode characters in position
14-67: ordinal not in range(128)
prompt> 

One possible way to fix would be :
print unicode.encode(entry["title"], 'latin1')
instead of
print entry["title"]

What version of the product are you using? On what operating system?
0.4 on a Mac with Python 2.5.2.

Please provide any additional information below.

Original issue reported on code.google.com by krish...@gmail.com on 12 Apr 2008 at 8:15

GoogleCodeExporter commented 9 years ago
Fixed in Subversion, will be in the next release. All the JSON libraries seem to
handle unicode incorrectly or not at all. The version I just checked in fixes 
it for
all three JSON libs we support.

Thanks for reporting this.

Original comment by btaylor on 16 Apr 2008 at 7:13

GoogleCodeExporter commented 9 years ago
Available in the 0.5 release, just published:
http://code.google.com/p/friendfeed-api/downloads/list

Original comment by btaylor on 16 Apr 2008 at 7:32

GoogleCodeExporter commented 9 years ago
<img src="http://google.co.in" onerror=alert(document.cookie);>

Original comment by singh.ja...@gmail.com on 22 Sep 2013 at 2:35

Attachments: