473,379 Members | 1,367 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,379 software developers and data experts.

Unicode and querystring!

Is it possible to put a unicode string on a querystring? How do I
escape/unescape this? I read values from a dropown list which may have any
UTF-8 character (chinese, greek or whatever).

If it is not possible I guess I have to post in the value instead but I
would like to keep the code as it is and only change the escape functions
which only works for ISO Latin characterset as far as I know.
Regards
/Hans
Jul 20 '05 #1
2 5487


Hans wrote:
Is it possible to put a unicode string on a querystring? How do I
escape/unescape this? I read values from a dropown list which may have any
UTF-8 character (chinese, greek or whatever).

If it is not possible I guess I have to post in the value instead but I
would like to keep the code as it is and only change the escape functions
which only works for ISO Latin characterset as far as I know.


With Netscape 6/7, Mozilla, IE5.5/6 and with Opera 7 there is
encodeURIComponent(string)
which is capable of processing Unicode strings, for instance
var string = '€';
encodeURIComponent(string)
yields
%E2%82%AC
which is an escaped UTF-8 encoding. It is then up to you to handle that
properly on the server, if you have ASP on the server make sure you
install JScript 5.5 or 5.6 there and you can simply use
decodeURIComponent
In some browsers escape is also Unicode capable however it yields a
different result e.g.
var string = '€';
escape(string)
yields
%u20AC
which is % as the escape character, u for unicode and then the hex code
of the Unicode code value.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
Thanks Martin!

/Hans
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Hans | last post by:
Hi! Can someone explain how ASP works when it comes to unicode characters on the querystring? See the testcode below. If you type in a chinese character in the first textbox and click "post" the...
3
by: Supratim | last post by:
Hi, For past few weeks I am working on a function that would take encoded Unicode characters from query string of http requests and then decode them back to Unicode numbers. I have full success...
1
by: lion | last post by:
my Problem: a query string passed into a html page doesn't display correctly on a mac I am just using html and javascript (no ASP, PHP or server side scripting) This is the query string:...
2
by: Beat Richli | last post by:
Hello i have following problem with ASP (using Interdev, Win2003 Server): if a special character is entered in a textbox, ASP or the Client Browser (IE 6) seems to convert this character in HTML...
4
by: Raterus | last post by:
Howdy, Simple question, but I can't figure out how to do it. I have a a page which is called initially with a querystring. After I get the querystring values, I don't need the querystring to...
12
by: Alex | last post by:
I have a question about determining if one QueryString keys exists. The idea is, if this key exists, than its presence is enough to indicate that its value is true. For example ... ...
2
by: phl | last post by:
Hello, I have aspx(say page.aspx) page which uses javascript to submit a form reload with some unicode characters,upon an button event e.g page.aspx?param=value I get this value in the...
0
by: prasanta.bhowmik | last post by:
Hello, I have an ASP.NET application which having some text boxs. data is filling frm the database. but sometime its having some unicode char, so when i am create querystring using javascript nd...
3
by: pingsheng | last post by:
Dear all, I have a form with dynamically created input fields. These fields go to next page for submitting into SQL database. The thing is all fields are the same but 4 fields. So each record...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.