Android的:如何存储URL中string.xml资源文件? [英] Android: How store url in string.xml resource file?
问题描述
我想存储一个完全合格的URL,也与查询参数:
I'm trying to store a fully qualified url, with also query params:
www.miosito.net?prova®=bis
但它造成一个问题,因为&放大器;章
类似于&放大器;章;
实体和android告诉我这和HTML实体写得不好。
but it's causing a problem because ®
is similar to ®
entity and android tell me that and html entity is not well written.
我需要这个,因为各个地区使用完全不同的URL查询参数的。
I need this because every locale uses a fully different set of url query param.
我试着用 [CDATA [...]]
但这语法由XML解析器不喜欢。
I tried with [[CDATA[.. ]]
but this syntax disliked by xml parser.
推荐答案
这个问题是不是与&放大器; REQ
但&安培;
本身。对于XML / HTML,你将不得不使用&放大器;放大器;
实体(或&放大器;#38;
),但为您的网址,而应该URL-CN code(看到文档)字符串,在这种情况下,说&安培;
应替换为 26%
。因此,最终的字符串应该是这样的:
The problem is not with &req
but with &
itself. For XML/HTML you would have to use &
entity (or &
), but for URLs you should rather URL-encode (see docs) strings, and in that case said &
should be replaced with %26
. So your final string should look like:
www.miosito.net?prova%26reg=bis
www.miosito.net?prova%26reg=bis
这篇关于Android的:如何存储URL中string.xml资源文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!