I have user data passed to an API, and sometimes it contains special characters such as:
- ” (written as ”)
- “ (written as “)
And others. A lot of the special characters are produced with a user has an apostrophie, " or ', and can vary across the unicoding used.
When values are passed and then checked as such:
$string = "” “";
strlen($string);
Strlen will output them 2, but when they go into the database they count as 6. This causes breaking issues with limited fields like character varying.
Why is strlen not correctly getting the length and what would be a solution for special characters?