473,382 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

url encode latin-1 characters

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
1 4643

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Laurent | last post by:
Hi, I have an XML file with this text in it: <price>10 &#x20AC;</price> (just an example) My input and output encodings are Latin 1 (ISO-8859-1). When PHP parses it, the characterdata...
12
by: Richard Townsend | last post by:
Using Python-2.3.4 on HP-UX11i, the following code: import locale loc = locale.setlocale(locale.LC_ALL) print 'locale =', loc loc = locale.nl_langinfo(locale.CODESET) print 'locale =', loc...
4
by: francescomoi | last post by:
Hi. I'm trying to store a text within a MySQL field (v 3.23.58) by using MySQLdb (v 1.2.1c3). The text is: "telephone..." (note the last character) And I get this error message:...
5
by: Scott Matthews | last post by:
I've recently come upon an odd Javascript (and/or browser) behavior, and after hunting around the Web I still can't seem to find an answer. Specifically, I have noticed that the Javascript...
3
by: Peter | last post by:
Hi, I try to make up a javascript string which contains numeric numbers in any positions. For example, I want to make a string: secretcode, where secretcode.charAt(0)==(-21),...
8
by: Stanley Sinclair | last post by:
You wrote the pleural of "schema" as "schemata." My heart is warmed. Americans write that as "schemas," since they have no concept of the history of either their language nor their own...
4
by: pretoriano_2001 | last post by:
Hello: Under win32 XP y select python command line and execute next code with results indicated: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) on Type "help", "copyright", "credits" or...
10
by: ahoway | last post by:
I am having problems entering a sentence for translating into pig latin. It is set up now to read the entire sentence as one word. I would like to know how to look at each word in the sentence so...
6
by: 7stud | last post by:
s1 = "hello" s2 = s1.encode("utf-8") s1 = "an accented 'e': \xc3\xa9" s2 = s1.encode("utf-8") The last line produces the error: --- Traceback (most recent call last):
7
by: luca72 | last post by:
hello i have this problem: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 8: ordinal not in range(128) Generally i solve the problem inserting : # -*- coding:...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.