Skip to content

fix(cli): escape special characters in Android strings.xml productName (fix #14634)#14920

Open
akuligowski9 wants to merge 2 commits intotauri-apps:devfrom
akuligowski9:fix/android-escape-product-name
Open

fix(cli): escape special characters in Android strings.xml productName (fix #14634)#14920
akuligowski9 wants to merge 2 commits intotauri-apps:devfrom
akuligowski9:fix/android-escape-product-name

Conversation

@akuligowski9
Copy link
Copy Markdown

Summary

  • Adds an android-string-escape handlebars helper that escapes &, <, >, ", and ' for Android string resources
  • Uses the helper in the strings.xml template for app_name and main_activity_title

Motivation

When productName in tauri.conf.json contains a single quote (e.g. "Aircraft's Hub"), cargo tauri android init generates invalid strings.xml that causes aapt2 to fail during Android builds. The handlebars engine is configured with no_escape, so {{app.stylized-name}} is rendered raw.

Approach

A new android-string-escape helper follows the existing pattern of html-escape and escape-kotlin-keyword. This keeps escaping explicit and visible in the template rather than silently modifying data before rendering. The helper handles both XML-level entities (&amp;, &lt;, &gt;) and Android string resource conventions (\', \").

Test plan

  • cargo check -p tauri-cli compiles
  • cargo clippy -p tauri-cli --no-deps — no new warnings (3 pre-existing needless borrow warnings in unrelated code)
  • cargo test -p tauri-cli — all 47 tests pass
  • Verified "Aircraft's Hub" would produce Aircraft\'s Hub in the generated XML

🤖 Generated with Claude Code

@akuligowski9 akuligowski9 requested a review from a team as a code owner February 9, 2026 22:11
@github-project-automation github-project-automation Bot moved this to 📬Proposal in Roadmap Feb 9, 2026
@akuligowski9 akuligowski9 force-pushed the fix/android-escape-product-name branch from afed792 to 0cec979 Compare February 20, 2026 18:53
@akuligowski9
Copy link
Copy Markdown
Author

Hi! Just checking in — this PR is ready for review. I've also signed the commits per the branch protection requirements. Would appreciate a look when you get a chance!

fix tauri-apps#14634)

When `productName` contains a single quote (e.g. "Aircraft's Hub"),
the generated `strings.xml` was invalid and broke Android builds.
Add an `android-string-escape` handlebars helper that escapes XML
and Android string resource special characters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@akuligowski9 akuligowski9 force-pushed the fix/android-escape-product-name branch from 0cec979 to f6457b3 Compare February 20, 2026 18:58
@Legend-Master Legend-Master added the ai-slop Low effort content, see https://github.com/tauri-apps/tauri?tab=contributing-ov-file#ai-tool-policy label Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-slop Low effort content, see https://github.com/tauri-apps/tauri?tab=contributing-ov-file#ai-tool-policy

Projects

Status: 📬Proposal

Development

Successfully merging this pull request may close these issues.

2 participants