In <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote:

> Here is my script:
> 
> from mechanize import *
> from BeautifulSoup import *
> import StringIO
> b = Browser()
> f = b.open("http://www.translate.ru/text.asp?lang=ru";)
> b.select_form(nr=0)
> b["source"] = "hello python"
> html = b.submit().get_data()
> soup = BeautifulSoup(html)
> print  soup.find("span", id = "r_text").string
> 
> OUTPUT:
> &#1087;&#1088;&#1080;&#1074;&#1077;&#1090;
> &#1087;&#1080;&#1090;&#1086;&#1085;
> ----------
> In russian it looks like:
> "привет питон"
> 
> How can I translate this using standard Python libraries??

Have you tried a more recent version of BeautifulSoup?  IIRC current
versions always decode text to unicode objects before returning them.

Ciao,
        Marc 
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to