3.2.0

http.request and special characters

parameter used by HTTP.Request is changing special characters

Coding example
var R = new Active.HTTP.Request;
R.setURL("./test.php");
R.setRequestMethod("POST");R.setParameter("lib", 'é');
R.request();

for example the character é is changed in é in the parameter of test.php.

How do I do not to loose these special characters?

thierry
December 22,
use the JavaScript function escape() to escape the characters. This should get rid of the problem. I had an issue like this a creative use of escape() helped.
Jim Hunter
December 22,
Thanks a lot for your help

I escape the character and after i decode (in php script)

It works well
thierry
December 23,
I tell you my problems with charsets and how I solved them in case it helps anyone:

Fact: The HTTPRequest method *always* uses UTF-8 for data sent via POST to the server. So the solution to almost all problems is to use UTF-8 always.

In my installation I had PHP.INI configured by default, so it used ISO-8859-1. Also, I migrated a Access database to MySQL and the data was codified in ISO-8859-1.

Steps to use UTF-8 always:

1. All the HTML I generate carry this meta tag:
meta http-equiv="Content-Type" content="text/html; charset=UTF-8"

2. In PHP.INI I put this configuration:
default_charset = "utf-8"

3. I imported tha data to MySQL through a filter to convert all to UTF
iconv -f iso-8859-1 -t utf-8 DATA_ACCESS.SQL > DATA_ACCESS_UTF8.SQL

Not my case, but if you use Apache 2, you should put this in httpd.conf:
AddDefaultCharset utf-8


With this steps all the problems were solved.

There is a funny test (tha Ñandú test) to help you to diagnose your problems in this area. Using this test I see that the problem thierry has is a ISO-8859-1 page that is being represented in UTF-8, that is the reason of the é.

The ñandú test and more info about this (in Spanish):
http://www.juque.cl/weblog/2006/04/02/ascii-unicode-utf8-y-la-iatarnaaianalizaaian-parte-ii.html
joakinen
May 3,

This topic is archived.

See also:


Back to support forum