ckChangeLog icon indicating copy to clipboard operation
ckChangeLog copied to clipboard

Quotations marks in text for a change

Open felixwiemuth opened this issue 8 years ago • 4 comments

In the <change> tags, using quotation marks as " or escaped as \" or even as \u0022 does not show the symbol in the dialog, there is no character instead. In Android resources this works (e.g. in strings.xml). Single quotes ' even cause the whole text following to be removed.

Using the actual characters „ “ ” ‚ ‘ ’ works, however.

felixwiemuth avatar Jan 02 '18 15:01 felixwiemuth

Works for me. Can you provide a changelog file that demonstrates the issue?

cketti avatar Jan 03 '18 11:01 cketti

Sure, here is one with screenshot of what I see (on Android 7.1.2 (LineageOS 14.1-20171214-NIGHTLY-klte), minSdkVersion 16, targetSDKVersion 26). changelog_master.xml.txt (.txt only for uploading here) screenshot_20180103-124404

felixwiemuth avatar Jan 03 '18 11:01 felixwiemuth

Looks like this works fine with AAPT, but is an issue when using AAPT2. Using &quot; to XML-encode double quotes doesn't work either. Presumably because AAPT2 decodes that when parsing the XML file for generating the resource file.

The contents of the <change> elements are added as-is to the generated HTML used for displaying the dialog. So as a workaround you could use HTML-encoded double quotes in your change entries. Because everything is an XML file you'll have to additionally XML-encode them. Doing that we'll end up with:

<release version="2.2" versioncode="13" >
    <change>&amp;quot;Normal quotes&amp;quot;</change>
    <change>“unicode quotes”</change>
    <change>&amp;apos;Single quotes&amp;apos;</change>
    <change>‘Unicode single quotes’</change>
</release>

Alternatively, you could disable aapt2 as described here: https://developer.android.com/studio/build/gradle-plugin-3-0-0.html

Issue in Google's bug tracker: https://issuetracker.google.com/issues/71805084

cketti avatar Jan 03 '18 12:01 cketti

Okay, thanks for the quick investigation. Probably using the proper unicode symbols for quotes doesn't hurt either ;).

But why does it work in strings.xml then? Shouldn't that be compiled with the same tool?

Anyway, just make sure to note it in your documentation if the problem cannot be solved.

felixwiemuth avatar Jan 03 '18 13:01 felixwiemuth