Home » Php » Laravel request returning unicode replacement character in array value

Laravel request returning unicode replacement character in array value

Posted by: admin October 26, 2017 Leave a comment

Questions:

I’m sending a json request (on diffrent platforms) and can’t getting the values with $request->all() function, as i expected. I have to validate name parameter with regex:/^[\p{L}]+$/ so it is not the case that i want. I must pass the request values to the Validator without any replacement.

Json Request example :

{
  "name": "guvuvıvıvöö",
  "surname": "bbbbbbbbbbbb",
  "phone": "+905544002218",
  "password": "123123123",
  "password_confirmation": "123123123",
  "dob": "2017-04-18",
  "gender": "1",
  "confirmationKey" : null
}

$request->all() function returns

array (size=8)
'name' => string 'guvuvvivöö' (length=12)
'surname' => string 'bbbbbbbbbbbb' (length=12)
'phone' => string '+905544002218' (length=13)
'password' => string '123123123' (length=9)
'password_confirmation' => string '123123123' (length=9)
'dob' => string '2017-04-18' (length=10)
'gender' => string '1' (length=1)
'confirmationKey' => null

Hope you can help me. if you want, i can share more code or information..

Answers: