473,806 Members | 2,236 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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",
"applicatio n/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 8036
polilop wrote:
i have set the header to "Content-Type",
"applicatio n/x-www-form-urlencoded;8859-2"
The correct form for the header would be
"applicatio n/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 encodeURICompon ent then
the charset is _not_ ISO-8859-2 but rather UTF-8 thus if you use those
functions then you should use
"applicatio n/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 encodeURICompon ent then
the charset is _not_ ISO-8859-2 but rather UTF-8 thus if you use those
functions then you should use
"applicatio n/x-www-form-urlencoded; charset=UTF-8"

but if its not too much bother..
Martin Honnen
The correct form for the header would be
"applicatio n/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
4847
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 Mosaic) used the plus symbol '+' as a substitute for the space in the last part of the URI, arguments to the object referenced (you know, all the stuff after the question mark in a URL). The ECMA-262 "Javascript" standard now supported by both...
7
5087
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 character num). Is that something for the future, or am I guaranteed that all % encodings (from encodeURI) will have exactly two hex digits following? Perhaps someone could shed some light on this or point me to quality site. Be gentle, I know...
1
6386
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 parameters = "metadata=" + encodeURI(document.getElementById("metadata").value); http_request.onreadystatechange = metadataUpdate; http_request.open( 'POST', "/servlet/SendJapText", true );
1
1377
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 same user from registering and direct them to a separate HTML page advising them that they already submitted the form. This is what I wrote so far, but cannot seem to get it to work....do I incorporate this into my existing html forms page of where?...
2
2226
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 the variable live on? It seems that it does (and I want it to), but is this correct? I thought that local variables (and objects) are destroyed when the function exits? I declared a callback function--function () {
5
8238
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 others. Could anyone give me a list of characters that need to be escaped using $_GET, and then also how to use them? Also, could you tell me if any characters simply are not allowed in a
3
3541
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 decodeURI* work. Can we all agree that this does *not* work: decodeURI("http://domain.com%"); Can we all agree that this *does* work: decodeURI("http://domain.com");
13
3383
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 post it, I gather the data (in A_process.php) and insert/update into a database using php and mysql. I then redirect back to the original page (A.php) using a "header" command. This all works fine. The customer would like me to put in "print"...
0
9718
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10617
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10370
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4328
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.