Quantcast
Channel: JetBrains Developer Community : Thread List - IntelliJ IDEA Users
Viewing all articles
Browse latest Browse all 5661

android string.xml apostrophe quoting

$
0
0

I have a line in a strings.xml file which builds fine when I build through eclpise but fails when I use the tools through IntelliJ 12.1.2 community edition.

 

This line:

 

 

    <string name="dcsNotifDismiss">Dismiss\n(“Don't Remind Me Again”)</string>

I get this error when building through IDEA:
android-apt-compiler: [DCS] PROJECTPATH/res/values/strings.xml:325: error: Apostrophe not preceded by \ (in Dismiss\n(“Don't Remind Me Again”))
The problem is, according to this page:
https://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling
It says it should work

Escaping apostrophes and quotes

If you have an apostrophe or a quote in your string, you must either escape it or enclose the whole string in the other type of enclosing quotes. For example, here are some stings that do and don't work:

<stringname="good_example">"This'll work"</string>
<stringname="good_example_2">This\'ll also work</string>
<stringname="bad_example">This doesn't work</string>
<stringname="bad_example_2">XML encodings don&apos;t work</string>

 

 

 

 

I would just quote it and be done with it, but on some devices when the apostrophe is quoted inside of the double quotes, it doesn't get drawn in the UI.

 

Howard


Viewing all articles
Browse latest Browse all 5661

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>