mardi 28 juin 2016

Laravel 5 localization lang file with special characters makes trans function return b appended to string

I have lang file for French, and strings with special characters are making problem. For example I have array 'success' with message:

'formResult'    => 'Le formulaire a été transmis avec succès.',

In my controller, when I type

dd(trans('pages/message.success.formResult'));

I get this printed on the screen:

b"Le formulaire a été transmis avec succès."

notice the 'b' letter appended at the beginning.

This is causing problems when trying to send message to blade, nothing is sent:

return redirect('/contact')->with('success', trans('pages/message.success.formResult'));

please note that this works:

return redirect('/recruite')->with('success', 'Le formulaire a été transmis avec succès.');

and problem is in return from trans function.

If string has no special characters, trans func works ok.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire