FIXED – WordPress-to-lead for Salesforce CRM Encoding problem
I spent some time on fixing this so I just wanted to let you know so you can fix this in you plugin for other users.
I was using Chinese for the error messages and it would not display in Chinese but the encoding got messed up.
After a long time I found the problem
$textinput .= htmlentities(stripslashes($options[$id]));
should be changed to
$textinput .= htmlentities(stripslashes($options[$id]), ENT_QUOTES, "UTF-8");
As per the PHP MANUAL
Like htmlspecialchars(), htmlentities() takes an optional third argument encoding which defines encoding used in conversion. If omitted, the default value for this argument is ISO-8859-1 in versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards. Although this argument is technically optional, you are highly encouraged to specify the correct value for your code.