I'm getting a list of people through a file_get_contents request and parsing that list.
While looping through them, if person passes some conditions I'll need to grab that persons data and creating a body for a post request.
But some of the values I'm getting contain different types of special characters. Like ü, æ, ø and so on. Whenever this happens the string is delivered as a binary string. Like: b"tæst". When these characters are not present it's delivered like "test".
array:14 [
0 => "23468"
1 => "Firstname"
2 => b"Læstname"
3 => "[email protected]"
4 => "center"
5 => "2016-11-29"
6 => ""
7 => ""
8 => ""
9 => ""
10 => "Level"
11 => "54698523"
12 => ""
13 => ""
]
After parsing the list, this is for example an array for one user. So when I wan't to do a string containing the users fullname I've tried something like:
htmlspecialchars($employee[1].' '.$employee[2], ENT_COMPAT,'ISO-8859-1', true);
But I need to returned this as json, and when I json_encode this it just returns false. I believe I've narrowed it down to the special character being responsible for it without knowing why.
So I suppose I'm asking what's happening here with the binary string in the json_encoding and is there a way I can convert that or do some other workaround to handle these special characters as well?