1

str = "asd€aaa";

$str = str_replace("€","",$str);

Not replacing the € sign for some reason.

I have mb_internal_encoding("UTF-8"); set up at the top of the file (which is saved in UTF-8).

The string originates from a MySQL db, so I also have these set:

mysql_set_charset('utf8',$conn);
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET COLLATION_CONNECTION = 'utf8_unicode_ci'");

Am I missing something?

Thanks,

1 Answer 1

4

This means the string coming from the database and the search string are not in the same encoding and are hence not recognized as the same character. Make sure your source code file is saved in UTF-8 as well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.