I have some XML files in res/xml
and I'm trying to escape characters as you would normally do in XML. I tried nearly every way possible:
<tag>Okay, I'll do it</tag>
<tag>Okay, I\'ll do it</tag>
<tag>Okay, I'll do it</tag>
<tag>Okay, I'll do it</tag>
<tag>Okay, I'll do it</tag>
None of them work, when I parse the file with XmlPullParser
, I always get only part of the text: Okay I
, split where the apostrophe was.
I also tried parser.setFeature(Xml.FEATURE_RELAXED, true)
, as suggested here, without success.
Is there any reason to this or any to fix this behavior?
EDIT: After more testing, it looks like this issue only happens with the apostrophe and no other escaped characters like &
.
I posted an issue here about this and I was told this was intended behavior and would not be fixed. That really makes no sense but what can I do.
I was proposed using the res/raw
folder, but then XML won't be optimized so I just used backtick `
and replaced it in code with an apostrophe.