Mr.AndroidShin / Dev Tools

Android · Resources

strings.xml Escaper

Paste plain text and get a properly escaped Android string resource. It handles the characters that quietly break a build or mangle your text — apostrophes, quotes, ampersands, angle brackets — and wraps the result in a ready-to-paste <string> element. Everything runs in your browser.

name=
Ad slot

What actually needs escaping

Android string resources are XML with a couple of extra rules, so two kinds of character cause trouble: XML characters and Android-specific ones. The classic build-breaker is a bare apostrophe — You're throws "unescaped apostrophe in string" until you fix it.

CharacterBecomesWhy
'\'Bare apostrophe is an Android error
"\"Bare double quote is an Android error
&&amp;Reserved XML character
< >&lt; &gt;Reserved XML characters
line break\nReal newlines are collapsed by Android
%%%Only when the string is a format string

Leading and trailing spaces are also collapsed unless the whole value is wrapped in double quotes, and a value that starts with @ or ? needs a leading backslash so Android doesn't read it as a resource reference. This tool takes care of those cases too.

About the % option

Percent signs only need doubling when the string is used with getString() and format arguments (like %1$s). If your text just happens to contain a percent sign and you never format it, leave the option off so 100% stays 100%. Turn it on for something like You're %1$s%% done.

FAQ

Is my text sent anywhere?

No. Escaping happens entirely in your browser with local JavaScript. Nothing is uploaded and there's no sign-up.

Why did my apostrophe break the build?

Android treats ' and " as special inside string resources. A bare apostrophe raises a build error; escaping it as \' (or wrapping the whole value in double quotes) resolves it.

Does this handle plurals or string arrays?

It escapes the value text, which you can drop into a <string>, an <item> inside <plurals>, or a <string-array> entry. The escaping rules are the same for all of them.

Ad slot