The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Encoding problems in python

i was trying to display some text
it is in utf-8 in postgres and when it
 is displayed in firefox and ie, it gets displayed as some symols with
 4numbers in a box or so even for ' apostrophe please tell me how to
display this properly i try title.__str__

I'm assuming that you're dynamically generating some HTML document.  If
so, have you declared the "document encoding" in the HTML file to be
utf-8?
Neanderthals’ Last Stand Is Traced
here is the html file

and here the python code for inserting
filt= Cheetah.Filters.EncodeUnicode()    web.insert('feed_entry',feedtable_id=feedt_id,title=filt.filter(d.entries[i].title),link=d.entries[i].link,updated=chkup)

and code for retriving feeds
i use cheetah to display 
    feedentry_dct=dict((i.id,web.query("select * from feed_entry where feedtable_id = $i.id ORDER BY
updated desc, created",vars=locals())) for i in feedlist)

how it is displayed in the html file or cheetah template
#for i in $feedentry_dct[$blog.id]
<a href="$i.link">
$str($i.title)
</a>
thanks for your help
ANil
digguser Send private email
Wednesday, September 13, 2006
 
 
Read joel's article about unicode
Learn python.
Learn string handling in python.
Learn the python DB-API
Realise that unicode is not neccessarily the default, even if the database defaults to unicode.
Realise that classic strings in python are bytestrings.
Arafangion Send private email
Wednesday, September 13, 2006
 
 
wat is diff between str and repr

Thursday, September 14, 2006
 
 
i was trying to display some text
 4numbers in a box or so even for ' apostrophe please tell me how to

and here the python code for inserting
filt= Cheetah.Filters.EncodeUnicode()    web.insert('feed_entry',feedtable_id=feedt_id,title=filt.filter(d.entries[i].title),link=d.entries[i].link,updated=chkup)

and code for retriving feeds
i use cheetah to display
    feedentry_dct=dict((i.id,web.query("select * from feed_entry where feedtable_id = $i.id ORDER BY
updated desc, created",vars=locals())) for i in feedlist)

how it is displayed in the html file or cheetah template
#for i in $feedentry_dct[$blog.id]
<a href="$i.link">
$str($i.title)
</a>
a Send private email
Friday, September 15, 2006
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz