Most of the wide-spread languages support Unicode and/or UTF-8 at least in some form; post-2K languages support Unicode quite commonly, but there are always few things to look after.
The magic quotes, and the safe mode… ‘nough said.
Fortunately, both of these are deprecated in new versions of PHP.
Unfortunately, most hostings are not that keen on updating PHP to the newest version (mainly they’re still stuck at the likes of version 5.1.x).
What to do?
Often “in the wild”, even in English texts, you meet both accented versions and non-accented versions of certain words, such as brand names.
You’re then facing two options – you can either work with both versions, or get rid of accents. The latter option bears advantage of cutting down the dimensionality of the problem, as you don’t need to presume that you support all existing versions of the spelling, but how to get there?
Few days ago I needed this code, but surprisingly, most of the stuff you can find on the Net is “I don’t know how”, and very scarcely you can see a code that seems to work.
Yet, it’s trivial.
After the previous WTF post about PHP, I was kinda hoping there won’t be any more unpleasant surprises regarding PHP… Nah, I was wrong.
OK, we all know, all is wrong with PHP. It’s a language where main programming style is hack/patch, and that’s also the way it’s organized. Where else do you have functions that in one variant have certain order of parameters and in other reversed?… OK, in quite a few, but that’s not the point.
For those of us that do need (or better yet, do want) a good password, unique to each application – system account, encrypted partition, ssh pubkeys, server administration, etc. etc. – we need a good generator; don’t forget that simple random typing also decreases entropy!
Here are 2 simple password generators I use (easy to carry around on your flash); both of them use what is readily available on most *nix systems.
Feel free to post your favourite one in comment, so that we all can learn and prosper!
Apache+mySQL+PHP is for sure among the best and the most popular combinations of web-development products; but sometimes a proper setup is a tricky bit.