Lurker wrote:
I want send latin-1 string to web server by url parameter
urllib.quote return just symbol code with preceeding percent for every
non-ascii character:
#>ustr = 'Ü'
#>urllib.quote(ustr)
'%9A'
The latin1 encoding for U-with-umlaut is 0xDC.
The cp850 encoding for the same is 0x9A.
I deduce that you typed the above in a DOS command window on a Windows
box.
Fire up IDLE and try the same thing again.
but this seems to be wrong because server response contains my
parameter and it differ from original (for example 'Ü' became '[')
You told it (maybe) that you were sending in latin1, then gave it 0x9A
which in latin1 is a control character (SCI, single character
introducer) and it gave you back a '[' ... garbage in, garbage out,
perhaps?
How about showing us (a) a snippet of the code you actually executed
(b) the repr() of what was returned -- *NOT* a copy/paste from the
screen; as shown above, a picture of U with two dots above it is not
reliable information.
Cheers,
John