【已解决】android的字符串资源文件values/strings.xml中不支持单引号’

<string name="home_butttom_show_text">What’s your goods look like…</string>

android values strings xml quote char

Special Characters in HTML

How can I write character ‘ in Android’s strings.xml? – Stack Overflow

Error in strings.xml file in Android – Stack Overflow

另外,好像:

html的

&quot;

按照道理来说,等价于:

'

是双引号

注:

'是单引号

"是双引号

搜:

html single quote

参考:

html – How to escape single quote – Stack Overflow

8.5 Named character references — HTML5

Are single quotes allowed in HTML? – Stack Overflow

html – How to escape double quotes in title attribute – Stack Overflow

【总结】

后来证明:

(1)特殊字符前加上反斜杠\,是可以的:

<string name="home_butttom_show_text">What\’s your goods look like…</string>

(2)最外层加双引号,表示整体是个字符串,也是可以的:

<string name="home_butttom_show_text”>"What’s your goods look like…"</string>

(3)'也是可以的:

<string name="home_butttom_show_text”>"What's your goods look like…"</string>

(4)但是&quot;却不能正常显示。

而且好像是:如果写,就要两个一起写,否则单个双引号和单引号一起写,还会报错。

注:

对于这些HTML实体字符,可参考:

HTML 字符实体

HTML ISO-8859-1 参考手册



发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量