How to fix "unescaped & or nonterminated character" error in string.xml

1k Views Asked by At

I added some Google Drive direct download links to string. The files up to 3MB in size downloaded successfully, but the files with size 3MB or more were not downloaded and made errors.

I tested the links and all the links were working, but when I changed "&" to "(&amp)" only the files with the smallest size downloaded and the the big size files were not downloaded.

1

There are 1 best solutions below

2
On

If (&amp semicolon) is not working, you should try using percent encoding: https://en.wikipedia.org/wiki/Percent-encoding

Replace &amp with %26. An example would be:

<string name="example">www.xyz.com?abcd%26abcd=abc</string>

Or

Try wrapping the url inside double quotes:

<string name="example">"www.xyz.com?abcd&abcd=abcs"</string>