As if you didn't know that,That error is PHP telling you that your input ($_) is not valid UTF-8. I don't have that line in my bootstrap/compiled.php, so we may need more detail about your setup to help you troubleshoot.
I know my company's website gets that error a lot because we have data that was stored in the DB before we standardized on UTF-8.
My preferred setup is where {PHP's internal encoding, the HTTP response's charset, the DB's/TABLE's internal encoding, the form's ENCTYPE, and the HTTP POST} are all defined to be UTF-8.
The solution
PHP multibyte string functions must be used, see in the PHP reference Multibyte String Functions.
Use mb_substr() instead of substr(). Use the u modifier for regex such as preg_match(). Multibyte problems with UTF-8 can be quite tricky as the may occur only sporadic since UTF-8 is for western countries mostly singlebyte.
johndavedecano said:
The solution
PHP multibyte string functions must be used, see in the PHP reference Multibyte String Functions.
Use mb_substr() instead of substr(). Use the u modifier for regex such as preg_match(). Multibyte problems with UTF-8 can be quite tricky as the may occur only sporadic since UTF-8 is for western countries mostly singlebyte.
I've already seen this solution but I don't understand: am I supposed to replace ALL substr() and ALL preg_match() functions in all Laravel's files ?
I mean it would be a long and hard process. Everything was ok with these both websites when they were running with WAMP.
Problem solved !
My PHP's version was < 5.4. With an upgrade to 5.5, everything is ok.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community