some fixes

Index: plugins/babel_plugin.py
===================================================================
RCS file: /home/cvs/neutron/plugins/babel_plugin.py,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 babel_plugin.py
61c61
<                       reply += '\n' + result
---
>                       reply += '\n' + result.decode('utf-8', 'replace')
Index: modules/babelizer.py
===================================================================
RCS file: /home/cvs/neutron/modules/babelizer.py,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 babelizer.py
70c70
<             re.compile(r']*>([^<]*)')
---
>             re.compile(r'<[Dd]iv style=padding:10px;[^>]*>([^<]*)')
116c116
< def translate(phrase, from_lang, to_lang):
---
> def translate(phrase, from_lang, to_lang, utf = 1):
123a124,126
>     if utf:
>       phrase.encode('utf-8', 'replace')
>
127c130
<                                  'urltext' : phrase.encode('utf-8', 'replace'),
---
>                                  'trtext' : phrase,
130c133,135
<         response = urllib.urlopen('http://babelfish.altavista.com/babelfish/tr', params)
---
>       babel = urllib.FancyURLopener()
>       babel.addheader('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7')
>         response = babel.open('http://babelfish.altavista.com/tr', params)
144a150
>     phrase.encode('utf-8', 'replace')
153c159
<         phrase = translate(phrase, next, flip[next])
---
>         phrase = translate(phrase, next, flip[next], None)

Index:

hm.. will test for utf input.

Syndicate content