In a recent project, I had the pleasure of fixing errors related to non-loading images when there were spaces in the file name. I thought: "What a simple problem, I will do it!" But, NAY! Just using UrlEncode() did not solve the problem.
The new issue was that the HttpUtilities.UrlEncode() switch HttpUtilities.UrlEncode() were mixed up ( ) on the pluses ( + ) instead of %20 , as in the browser. Therefore, file+image+name.jpg will be returned not found, and file%20image%20name.jpg will be found correctly.
Fortunately, a colleague pointed me to HttpUtilities.UrlPathEncode() at me, which uses %20 for spaces instead of + .
WHY are there two ways to handle Url encoding? WHY are there two teams that behave differently?
quakkels
source share