My Browser shows URL with file name as
http://www.example.com/pdf/204177_20090604_Chloorhexidine_DCB_oogdruppels_0%2C1%25.pdf
Act开发者_开发百科ual File name is 204160_20090604_Atropine_DCB_oogdruppels_0,5%.pdf
After urldecode, it gives wrong file name as
http://www.example.com/pdf/204177_20090604_Chloorhexidine_DCB_oogdruppels_0,1%.pdf
Update:
Initially I thought that its problem of URL Decode, but files like name 204153_20090605_Aluminiumacetotartraat_DCB_oordruppels_1,2%.pdf
while rendering in browser throws Bad request. I am using Kohana 3 framwork. Is it related with server?
$url = 'http://204160_20090604_Atropine_DCB_oogdruppels_0,5%.pdf';
$encode = urlencode($url);
$decode = urldecode($encode);
echo $url."<br />";
echo $encode."<br />";
echo $decode."<br />";
// outputs
http://204160_20090604_Atropine_DCB_oogdruppels_0,5%.pdf
http%3A%2F%2F204160_20090604_Atropine_DCB_oogdruppels_0%2C5%25.pdf
http://204160_20090604_Atropine_DCB_oogdruppels_0,5%.pdf
All ok. You're error is somewhere else.
You are looking at two different files.
It's not possible to urlencode 204160_20090604_Atropine_DCB_oogdruppels_
into 204177_20090604_Chloorhexidine_DCB_oogdruppels_
, encoding does not change alphabetical characters.
The error is most likely in the code that creates the file list and outputs the links; the mapping between link titles and filenames appears to be messed up.
this will give you exact file name m using c#
Server.UrlDecode("http://www.example.com/pdf/204160_20090604_Atropine_DCB_oogdruppels_0,5%25.pdf")
, (comma) is encoded as %2c % (percent) is encoded as %25 by browsers
if you use Request.Url
it'll decode ,(comma) but not %(percent)
So Server.UrlDecode("xyz") decode all characters except %(percent), thats y there's "%25" in the above filename
精彩评论