Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does b"string" mean in dd() function?

dd($result);

Result:

...
+description: "عند...ترنت."    
+keywords: b"°ó¨Ü¨ü¨ê...Ü°®"
...

+keywords has the letter 'b' in front of the string, description does not have that... What does the 'b' mean? And if it is possible, how can I convert the string?

Btw, this is the result if I var_dump the keywords: string(116) "���,����,�,��,����������,����������,��,��������,�������,������:"

I think it has to do something with charset, i'm using UTF-8.

like image 201
Dirk Jan Avatar asked Feb 14 '17 10:02

Dirk Jan


1 Answers

If you read: https://symfony.com/doc/current/components/var_dumper.html (which is what Laravel is using) you can see:

enter image description here

So the answer is the string is not valid in UTF-8 (I am guessing b stands for binary).

Maybe check if you can detect the encoding if it's something else.

like image 173
apokryfos Avatar answered Oct 16 '22 00:10

apokryfos