Skip to content

Astro compiler misparses Unicode quotation marks (U+201C, U+201D, U+201E) in template attributes #16222

@Kameeleonn

Description

@Kameeleonn

Bug description

The Astro compiler incorrectly handles Unicode "smart" quotation marks („" — U+201E/U+201D, and "" — U+201C/U+201D) when they appear inside HTML attribute values in the template section of .astro files.

When a template attribute like answerBox="text with „quoted words" inside" is compiled, the right double quotation mark " (U+201D) is interpreted as closing the attribute value — even though it's a different character from " (U+0022). This causes the remaining text to be parsed as separate HTML attributes, producing invalid compiled JavaScript like {".":true,"next":true,"word":true,...}.

Expected behavior

Unicode quotation marks („", "", «») inside "" attribute values should be treated as regular text content, not as attribute delimiters. Only ASCII " (U+0022) should close an attribute opened with ASCII ".

Reproduction

---
// No frontmatter needed
---

<SomeComponent
  text="This has „Polish quotes" inside"
/>

The compiled output incorrectly splits "Polish quotes" as if " (U+201D) closes the attribute, producing broken JS.

Workaround

Use JSX expression syntax instead of HTML attribute syntax:

<SomeComponent
  text={'This has „Polish quotes" inside'}
/>

Or avoid Unicode quotation marks entirely in attribute values.

Impact

This is particularly problematic for multilingual sites (Polish, German, Czech, Slovak use „" quotation marks; French uses «»; Ukrainian uses «»). Any i18n content with native quotation marks in component props will break the build silently.

Environment

  • Astro: 6.1.3
  • @astrojs/cloudflare: 13.1.7
  • @astrojs/compiler: (bundled with astro)
  • esbuild: 0.27.4
  • Node: 25.2.1
  • OS: macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageIssue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions