Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Problem with AJAX and Special Chars (Perl, MySQL 4)

Reply
Thread Tools

Problem with AJAX and Special Chars (Perl, MySQL 4)

 
 
design4future
Guest
Posts: n/a
 
      03-16-2006
Hello

I've developed an PHPMYADMIN lookALike in AJAX,Perl,Mysql.
All owrks fine except the french, german special chars.


AJAX-Part:
At the moment i create an XMLhttpRequest-Object with
new XMLHttpRequest();
or
new ActiveXObject("Microsoft.XMLHTTP");

now the function opens the connection ...
obj.open("POST", URL);

then i add an HTTPheader with
obj.setRequestHeader("Content-Type","application/x-www-form-urlencoded;
charset=UTF-8");

now i call the send methode
obj.send(CGIVars);
The CGIVars are urlencoded with "encodeURIComponent"


thats the AJAX-Part


In Perl:
Now i fetch the Params with
CGI->param("postVarname");

and store them over DBI & DBD::mysql into the database.
This works fine too. It occurs no error.


But the output from chars like "äöü" in the database are corrupted.
They look like "ää".
I have check this with phpmyadmin


The



Where is the bug?
When i convert the values over encode_utf8() they are damaged too.
+ But I think they are already in UTF8 or not? Perl handles all
internal strings in UTF8 or not?
+ How can i check which encoding is used in Perl?
+ Is the Ajax-Header correct?
+ Javascript sends all the data via POST or GET in UTF8, or not?


SYSTEM-Information:
Windows XP SP1
Apache 1.3
Perl 5.8.0 Build 806
Mysql 4.1.18-nt (collation: utf8_unicode_ci)
DBI Version 1.48
DBD-mysql Version 3.00002
phpmyadmin 2.7.0-pl2
Checked with Firefox 1.5.01




Thanks for every suggestion.


best regards,

robert

 
Reply With Quote
 
 
 
 
Michael Kindermann
Guest
Posts: n/a
 
      03-16-2006
design4future wrote:

> Hello
>
> I've developed an PHPMYADMIN lookALike in AJAX,Perl,Mysql.
> All owrks fine except the french, german special chars.
>
>
> AJAX-Part:
> At the moment i create an XMLhttpRequest-Object with
> new XMLHttpRequest();
> or
> new ActiveXObject("Microsoft.XMLHTTP");
>
> now the function opens the connection ...
> obj.open("POST", URL);
>
> then i add an HTTPheader with
> obj.setRequestHeader("Content-Type","application/x-www-form-urlencoded;
> charset=UTF-8");
>
> now i call the send methode
> obj.send(CGIVars);
> The CGIVars are urlencoded with "encodeURIComponent"
>
>
> thats the AJAX-Part
>
>
> In Perl:
> Now i fetch the Params with
> CGI->param("postVarname");
>
> and store them over DBI & DBD::mysql into the database.
> This works fine too. It occurs no error.
>
>
> But the output from chars like "äöü" in the database are corrupted.
> They look like "��".
> I have check this with phpmyadmin
>
>
> The
>
>
>
> Where is the bug?
> When i convert the values over encode_utf8() they are damaged too.
> + But I think they are already in UTF8 or not? Perl handles all
> internal strings in UTF8 or not?
> + How can i check which encoding is used in Perl?
> + Is the Ajax-Header correct?
> + Javascript sends all the data via POST or GET in UTF8, or not?
>
>
> SYSTEM-Information:
> Windows XP SP1
> Apache 1.3
> Perl 5.8.0 Build 806
> Mysql 4.1.18-nt (collation: utf8_unicode_ci)
> DBI Version 1.48
> DBD-mysql Version 3.00002
> phpmyadmin 2.7.0-pl2
> Checked with Firefox 1.5.01
>
>
>
>
> Thanks for every suggestion.
>
>
> best regards,
>
> robert

I had a similar Problem with html code and decoding helped.
$text = decode("utf8", $text);

kimi
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to truncate char string fromt beginning and replace chars instring by other chars in C or C++? Hongyu C++ 9 08-08-2008 12:18 PM
Floats to chars and chars to floats Kosio C Programming 44 09-23-2005 09:49 AM
Problem with minidom and special chars in HTML Horst Gutmann Python 6 02-24-2005 11:38 AM
display VARCHAR(mysql) and special chars in html Jonas Meurer Python 6 02-23-2005 09:45 AM
receiving ??? chars instead of "special" chars M.Posseth ASP .Net Web Services 3 11-16-2004 07:00 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57