Special Characters
Moderator: General Moderators
Special Characters
Is there a way that PHP can intercepts keyboard inputs. I'm try to produce special characters when a user type a combination of keys. For example, if the user type a' , have the output display á, or if the user type e^ , have the output display ê . Does anyone have any tips? Thanks... 
If you're wanting to do this on the page before it's submitted, you'd have to use a client side language, as PHP wouldn't handle it.
If you're wanting to change the input into a different character set, I found the functions iconv() and recode_str().
If you're just wanting to change a set of certain characters, like your example, str_replace would be suitable.
If you're wanting to change the input into a different character set, I found the functions iconv() and recode_str().
If you're just wanting to change a set of certain characters, like your example, str_replace would be suitable.
Code: Select all
$data = $_POST['data'];
$combinations = array("e^","a'","etc");
$replacements = array("specialchar1","specialchar2","etc");
// sorry, I don't know how to do the special characters
$newdata = str_replace($combinations,$replacements,$data);Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.