问题描述
我对描述标签可以使用什么字符感到困惑。
例如,我要使用
{ description: "this is a backslash \ here" }
我知道JSON不允许在不转义的情况下使用反斜杠
我的问题是我是否用\ u005C'代替\
{ description: "this is a backslash \u005C here" }
解决方法
Google将使用json规则解析数据,因此很有可能将其视为反斜杠。
一种想法的一种方法是在浏览器控制台中运行这样的评论。
console.log({ description: "this is a backslash \u005C here" });
这也会导致反斜杠:
console.log({ description: "this is a backslash \\ here" });
Google会对其看到的字符串进行自己的后处理。例如它很可能会删除所有html和一些表情符号。
有时候Google甚至在编码/解码方式上存在一个错误,可能会导致奇怪的输出。
确定的唯一方法是测试。但我认为您会没事的,因为在这种情况下,编码是通过json处理的。