I have this problem: I have a javascript, saved in a database field, that is going to be used in a web page as a href target, e.g.
insert into table_with_links (id, url)
values (1, 'javascript:var url="blö blö";.....');
// run scripts that use the database values to generate web pages
// part of the generated html code:
<a href="javascript:var url='blabla';..... </a>
So far no problems. I have german letters (Umlaute - e.g. ö) in the javascript. I shouldn't save the german letters in the database, so I escape them:
insert into table_with_links (id, url)
values (1, 'javascript:var url="bl%F6 bl%F6";.....');
Now comes the problem - I shouldn't store the % sign in the database either, because the scripts that generate the web pages cannot handle it properly. I guess you can imagine how these scripts are 3-rd party scripts and cannot be changed.
So, my question is - can I also escape the % sign?