最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

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

Android crifan 8633浏览 0评论
<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 参考手册

转载请注明:在路上 » 【已解决】android的字符串资源文件values/strings.xml中不支持单引号’

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.181 seconds, using 22.10MB memory