I am creating URL links with request form values (?a=b&c=d) in JavaScript and submitting to a PHP page. I am using encodeURIComponent in JavaScript to properly encode the form information.
I've already tested this and I've found that the values in $_REQUEST are already urldecode
'd. So I've taken my urldecode calls out of my php, as they are redundant and potentially harmful for some input.
The purpose of this question is just to get some reassurance that I tested this correctly my understanding is correct, and that under normal conditions you don't need to explicitly call urldecode in php.
I would like to use decodeURI
or decodeURIComponent
as in JavaScript in my Lua (Luvit) project.
JavaScript:
decodeURI('%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82')// result: привет
Luvit:
require('querystring').urldecode('%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82')-- result: '%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82'
I use URLDecode/URLEncoder class like this:
String decodeStr = URLDecoder.decode(str, "UTF-8");
but my security tools says Avoid dangerous J2EE API
, and use
Encoder.encodeForURL()/decodeForURL()
instead of
URLDecoder.decode()
So please anyone can suggest for this point
URLDecoder.decode()
not secure?The value is correct in the URl: /optimization/page/%2Flove-your-body-club.html
But when I collect the url in the given variable in the function, the .html is removed.
function($url){$urlDecoded = urldecode($url);
I have tried to echo out both encoded and decoded values, but the .html is still missing.
Since I use page suffix .html as default in codeigniter, it seems it reads this as not part of the passed variable.
Any workaround to this?
For example, when I type the following:
google-chrome https://somewebsite.com/somepage/#someheading
It will open the exact URL (without encode) in the browser.
But when I try to open from local file:
google-chrome ~/localdirectory/index.html#someheading
It will open the following:
file:///home/imampt/localdirectory/index.html%23someheading
Which will result in "Your file was not found".
The following command works, however:
google-chrome ~/localdirectory/index.html
How to open a local URL without encoding from the command line?
Please note that by viewing our site you agree to our use of cookies (see 개인 정보 보호 for details). You will only see this message once.