tags:

views:

68

answers:

1

While trying to run a string through PHP's htmlentities function, I have some cases where I get a 'Invalid Multibyte Sequence' error. Is there a way to clean the string prior to calling the function to prevent this error from occuring?

+1  A: 

htmlentities()' default charset is ISO-8859-1. (Manual)

You are probably applying it to a UTF-8 string.

Specify the character set using

htmlentities($string, (whatever), "UTF-8");
Pekka