0

A French character, ç, appears to be breaking my application.

The script harvests data from an external application, then uses post to send this data to our apache/php server to be processed.

For security reasons, anything sent to the server must be accompanied by a hash (md5) of the data, time of sending, user info etcetera to verify the user has permissions to carry out the action.

Now, for whatever reason, actions are getting rejected if there are certain characters in the data string that gets hashed, like the ç.

How can I avoid this? Is there a certain encoding I should be set so they are correctly processed?

A regex that could replace all ç with c, and so on for all non-English letters?

There is also the potential for German and Spanish input to be harvested with this tool so would like to find a catch-all solution!

ErosRising
  • 165
  • 7
  • You should use UTF8 throughout your application. I have previously written [**an answer with a checklist**](https://stackoverflow.com/questions/31897407/mysql-and-php-utf-8-with-cyrillic-characters/31899827#31899827) (PHP/MySQL) of what you should set to UTF8. For more in-depth, there's [UTF-8 all the way through](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through). Using UTF8 you'll handle all characters you'll need to (French, German, Spanish, Norwegian, Chinese...) -- do not use a regex to replace characters, that's a poor hacky-fix. Solve the encoding issues instead. – Qirel Mar 18 '19 at 10:01
  • Special characters should not interfere with the hashing algorithm. They are just different groups of bits that go through the algorithm. You are probably not correctly using UTF-8 throughout your application. You have to make sure you [use UTF-8 all the way through](https://stackoverflow.com/q/279170/5914775). – Tom Udding Mar 18 '19 at 10:03

0 Answers0