json_decode与\ u字符有关

时间:2018-04-14 15:09:43

标签: php json unicode utf-8

我正在尝试解码从Eventbrite API收到的json,其中包含以下字符:

"The Zone Sports\u00a0\nWE TEACH AND BUILD LIFE SKILLS\nOur programs helps build your child\u2019s self-esteem, self-discipline,Work ethic and teamwork skills they\u2019ll need to succeed in life." 

在此字符串上使用json_decode后,我得到以下文字:

"The Zone Sports WE TEACH AND BUILD LIFE SKILLS Our programs helps build your child’s self-esteem, self-discipline,Work ethic and teamwork skills they’ll need to succeed in life." 

最后应该显示以下内容:

The Zone Sports WE TEACH AND BUILD LIFE SKILLS Our programs helps build your child’s self-esteem, self-discipline,Work ethic and teamwork skills they’ll need to succeed in life.

然后将此数据写入SQL数据库,然后通过API发送到移动应用程序和网站 我不是100%确定这是否是正确的处理方法,但我正在尝试将\ u字符直接写入数据库,因此在阅读时它们仍然是正确的格式。 整个问题发生在json_decode上 如果我在解码之前对文本进行var_dump它看起来没问题,解码之后就搞砸了。
有没有我需要添加到json_decode函数的选项,或者可能事先对字符串进行一些更改?

0 个答案:

没有答案