By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,548 Members | 1,402 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,548 IT Pros & Developers. It's quick & easy.

url encode latin-1 characters

P: n/a
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'

but this seems to be wrong because server response contains my
parameter and it differ from original (for example '' became '[')

Jul 23 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

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

Jul 24 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.