Support the ongoing development of Laravel.io →
Installation Configuration
Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

Problem solved !

My PHP's version was < 5.4. With an upgrade to 5.5, everything is ok.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Flobesst flobesst Joined 3 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.