Converting ASCII value in the middle of a string

I have a script in PHP that stores values to a MySQL database from a web store. The store allows customers to leave a message which can create havoc when they use emojis. To prevent these characters from breaking my script I've used FILTER_SANITIZE_STRING and FILTER_FLAG_STRIP_HIGHon all my strings prior to sending them all to MySQL.

This works well except for when I display it again in a Java program I've written I'll have things like "I'm" instead of "I'm".

Is there a way to have Java find and convert the ASCII values back into characters?

My current plan of attack is to have a function that takes each relevant string column, examines each word looking for &#, finds the position of the simi-colon after the &#, replaces that value with the corresponding ASCII character, and returns the new string.

It's doable, but I'm hoping there is an existing means to do this without re-inventing the wheel.

#java #php #mysql

3 Likes2.50 GEEK