imagine a title bar in any language (English, Arabic, Japanese, etc.) containing a few words in UTF-8. Example:
$stringRAW = "Blues & μπλουζ Bliss ブルース Schön";
Now this needs to be converted to what is the real part of the URL of this page:
$stringURL = "blues-μπλουζ-bliss-ブルース-schön"
just check out this link This works on my server too!
Q1 . What characters are valid as valid URL these days? I remember that I saw Arabic strings sitting in the browser, and I tested them on my Apah 2, and everything worked perfectly.
I guess it should become: $stringURL = "blues-blows-bliss-black"
Q2. What existing php functions do you know that correctly encode / convert these UTF-8 strings for a URL, tearing them away from any invalid characters?
I guess at least: 1. spaces should be converted to a dash -
2. delete invalid characters? who are they? @ and '&'?
3. Converts all letters to lowercase (or letters to capital letters valid in URLs?)
Thank you: your suggestions are greatly appreciated!
string url php url-rewriting
Sam
source share