I name an image file as 100%-satisfaction-guarantee-icon.png, then put it in my webpage, as below:
<img src="<?php bloginfo('template_directory'); ?>/images/100%-satisfaction-guarantee-icon.png" alt="100% Satisfaction Guarantee" width="124" height="126" />
But the image will not show. So I just wonder whether '%' can be used in image file name? And which rules are applied to file names for web pages?
CodePudding user response:
A % in a path signifies encoding the URL for the purpose of using special characters (replaces unsafe ASCII characters). I believe this also applies to img tags in HTML.
Check out this wiki link Percent-encoding or this W3 resource HTML Encoding for more information.
CodePudding user response:
Yes, you can simply percent-encode the %
symbol. You can put %
instead of %
So instead of
100%-satisfaction-guarantee-icon.png
you could refer to it as
100%-satisfaction-guarantee-icon.png