When I input data such as : Œ, œ, Ÿ, … , €, ≤, ≥, ∞, ≈, ≠, – , — , ‐ , ‑ , ‹ ›, “ ”, ‘ ’
And then try to access data from the $_REQUEST['some_value']
I get this as my output
¼, ½, ¾, … , ¤, ≤, ≥, ∞, ≈, ≠, – , — , ‐ , ‑ , ‹ ›, “ ”, ‘ ’
What exactly is happening here?
We call this Character encoding.
When you input special characters, PHP converts them to their HTML entity representations. This happens when PHP processes form submissions or access request data.
To handle this, you can use this on page
header('Content-Type: text/html; charset=utf-8');
if AJAX,
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
FYI: To check data use
echo htmlspecialchars($value);
But when processing$originalValue = $_REQUEST['some_value'];
is enough.