473,402 Members | 2,053 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,402 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 7984
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: 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...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.