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

encodeURI

I'm having problems encoding URI. I have a page in which I use
XMLHttpRequest
to send a request. In my request it is possible to have Central European
characters.
When i send the request through mozilla, the URL is encoded (the character Z
in to %AE)
my problem is that IE dose not encode the character, it tourns it into ?,
and if I use the
javascript encodeURI for the same Character (Z) i get %C5%BD,
i have set the header to "Content-Type",
"application/x-www-form-urlencoded;8859-2"
and my page is saved in 8859-2.
So how can i make IE encode or even the javascript encodeURI function to
encode like Mozilla?
Apr 18 '07 #1
2 7979
polilop wrote:
i have set the header to "Content-Type",
"application/x-www-form-urlencoded;8859-2"
The correct form for the header would be
"application/x-www-form-urlencoded; charset=ISO-8859-2"
However if you set that header then it is up to your code to make sure
the argument passed to the send method has that encoding and charset.
If you use the JavaScript functions encodeURI or encodeURIComponent then
the charset is _not_ ISO-8859-2 but rather UTF-8 thus if you use those
functions then you should use
"application/x-www-form-urlencoded; charset=UTF-8"

--

Martin Honnen
http://JavaScript.FAQTs.com/
Apr 18 '07 #2

First of all thanks a lot, been googling for few day's and couldn't find
anywhere that the
encodeURI function only encode's UTF-8, so this workes fine for me
Martin Honnen
If you use the JavaScript functions encodeURI or encodeURIComponent then
the charset is _not_ ISO-8859-2 but rather UTF-8 thus if you use those
functions then you should use
"application/x-www-form-urlencoded; charset=UTF-8"

but if its not too much bother..
Martin Honnen
The correct form for the header would be
"application/x-www-form-urlencoded; charset=ISO-8859-2"
However if you set that header then it is up to your code to make sure the
argument passed to the send method has that encoding and charset.
How can i make this work (for 8859-2) with javascript if encodeURI only
encode's the UTF-8, and
why do mozilla and IE differently get the encoding?

Thanks for the help


Apr 18 '07 #3

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

Similar topics

1
by: Elf M. Sternberg | last post by:
It's all Netscape's fault. RFC 2396 (URI Specifications) specifies that a space shall be encoded using %20 and the plus symbol is always safe. Netscape (and possibly even earlier browsers like...
7
by: Csaba Gabor | last post by:
If I do alert(encodeURI(String.fromCharCode(250))); (in FF 1.5+ or IE6 on my winXP Pro) then I get: %C3%BA Now I was sort of expecting something like %u... (and a single (4 digit?) unicode hex...
1
by: smartestdesign | last post by:
I am trying to send request using ajax with some japanese text. As any of you know XMLHttpRequest is send with utf-8. I was hoping there is a way to send with different encoding like var...
1
by: jsmarton | last post by:
Hello All, I have been working on this assignment to do the following: 1. Modify the prototype so that once all fields are verified, cookie is added to the user's computer. 2. Block the...
2
by: Jeff | last post by:
Hello, I assigned a new object to a local variable ("req") in a function (see below). The local variable "req" is obviously destroyed when the function exits, but should the object referenced by...
5
by: chad.a.morris | last post by:
I don't have a lot of experience using $_GET. I need to know how to pass characters in using the $_GET method. The character I'm having a problem with right now is '#', but I'm sure there are...
3
by: vbgunz | last post by:
forgive me for my bumbling confusion. I am learning javascript and got caught up in a gotcha. this may be due to Mozillas spidermonkey or most likely to my n00b mindset on how encodeURI* and...
13
by: sheldonlg | last post by:
I could use a little help here. I have goodled with not much luck. I have been at this for a bit and would appreciate suggestions. I have a form (A.php) that collects a lot of data. When I...
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: 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: 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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.