views:

66

answers:

1

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.

A: 

you can try to use the CGI module, and perform

$uri = CGI::escape($uri);

maybe it depends of the context your try to escape the uri.
This worked fine for me in CGI context.

After you added details, i can suggest :


<div style='display:none;' id='summary_".$note_count."_note'>".CGI::escape($summary)."</div>"; 
benzebuth
i admit that i don't really understand your question : do you need to encode or decode the uri ?
benzebuth