I wrote a simple script to scrap news from yahoo and display them in
my site.
The problem is that the news are in spanish, and the text I get
doesn't show properly the spanish accents.
I guess it has something to do with encoding formats but I'm
completely ignorant of this matter.
In webpy docs I found the utf8 function, but it doesn't seem to
work...

I'd like to know if this problem is webpy related or not. This is the
code (webpy 0.3):

class news(app.page):
    def GET(self):
        web.header('Content-Type', 'text/html; charset=UTF-8')
        from google.appengine.api import urlfetch
        from BeautifulSoup import BeautifulSoup
        from google.appengine.api import mail

        page = urlfetch.fetch("http://ar.news.yahoo.com";, headers=
{'Content-Type': 'text/html; charset=UTF-8'})
        soup = BeautifulSoup(page.content)
        s=[]
        block = soup('ul',{"class":"headlines"})
        for i in block:
            s.append(str(i))
        res = ''.join(s)
        #res = utils.utf8(res)
        res = res.replace('"/', '"http://ar.news.yahoo.com/')
        return utils.utf8(res)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to