I have been struggling with the UTF-8 charset for quite a while now, and I am still confused about some things.
I have a web page which allow clients to create HTML files and directories on server. The directory name can be in any language. Adiós, días, chapter, level etc. The directories created are later on used as a URL for the HTML files created. Let’s say the user created a directory Adiós
and then a file called welcome.html
. To view this file, the client clicks a link and for that I get the directory and file name to create a path Adiós/welcome.html
. Now I am confused about these things.
When making the directory in php, should I
urlencode()
every file and directory name?If I do
urlencode
the directory name, will the browser be able to open my HTML page? Instead ofhref="Adiós/welcome.html"
it will behref="Adi%C3%B3s/welcome.html"
.There’s sometimes an image on my web page which I will src as
"Adi%C3%B3s/ing.jpg"
; is this going to work?Should the url in address bar show non‐ASCII characters?
I actually urlencode()
d everything but ran into issues as described in point 2 and 3, so I wanted to know what the right approach is for directory naming when working with languages other than English!