How to avoid malformed URI sequence error?

Posted by Luci on Stack Overflow See other posts from Stack Overflow or by Luci
Published on 2010-08-25T15:07:18Z Indexed on 2012/09/17 3:38 UTC
Read the original article Hit count: 172

Filed under:
|
|

I'm working with perl. I have data saved on database as  “

and I want to escape those characters to avoid having malformed URI sequence error on the client side. This error seems to happen on fire fox only. The fix I found while googling is not to use decodeURI , yet I need this for other characters to be displayed correctly.

Any help? uri_escape does not seem enough on the server side.

Thanks in advance.


Detalils: In perl I'm doing the following:

print "<div style='display:none;' id='summary_".$note_count."_note'>".uri_escape($summary)."</div>"; 

and on the java script side I want to read from this div and place it on another place as this:

getObj('summary_div').innerHTML= unescape(decodeURI(note_obj.innerHTML));

where the note_obj is the hidden div that saved the summary on perl. When I remove decodeURI the problem is solved, I don't get malformed URI sequence error on java script. Yet I need to use decodeURI for other characters.

This issue seems to be reproduced on firefox and IE7.

© Stack Overflow or respective owner

Related posts about perl

Related posts about escaping