I got it working with a utf-8 query by adding an Accept-Charset header to the
request. I used the 'Tamper Data' add-on to Firefox to view all the request
headers being sent by the browser. I added all the same headers to the Python
request and it worked. Then I took out the headers until I found
OK this is actually starting to make sense :-) Here is what I think is
happening:
You get different results in the IDE and the console because they are using
different encodings. The IDE is using utf-8 so the params are encoded in utf-8.
The console is using latin-1 and you get encoded latin-1
Jorge Louis de Castro wrote:
> Thanks again,
> Ok, it seems unpacking list items returns different types of string
> representations. Playing around on the interpreter this is what I found:
>
> lst = ['r', 'ent\xc3\xa3o?']
>
print lst[1]
>
> então?
>
s = lst[1]
print lst
>
> [
Jorge Louis de Castro wrote:
> Hi, thanks for the reply.
>
>
> However, I get strange behavior when I try to feed text that must be
> unicode to altavista for translation.
> Just before sending, I've got the following on the log using
>
> print "RECV DATA: ", repr(data)
>
> and after entering
The Exception thrown is:
EXCEPTION ENCODING 'ascii' codec can't decode byte 0xc3 in position 4:
ordinal
not in range(128)
I was dealing w/ a Ascii string and was asking it to be encoded in UTF,
whereas Python is telling me he can't encode it in UTF?? Makes little sense
to
Jorge Louis de Castro wrote:
> Hi,
>
> How do I set the encoding of a string? I'm reading a string on a Entry
> widget and it may use accents and other special characters from languages
> other than English.
> When I send the string read through a socket the socket is automatically
> closed. Is
Hi,
How do I set the encoding of a string? I'm reading a string on a Entry
widget and it may use accents and other special characters from languages
other than English.
When I send the string read through a socket the socket is automatically
closed. Is there a way to encode any special characte