Skip to content

[compiler] Fix for string attribute values with emoji #33096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2327,9 +2327,12 @@ function codegenInstructionValue(
* u0080 to u009F: C1 control codes
* u00A0 to uFFFF: All non-basic Latin characters
* https://en.wikipedia.org/wiki/List_of_Unicode_characters#Control_codes
*
* u010000 to u10FFFF: Astral plane characters
* https://mathiasbynens.be/notes/javascript-unicode
*/
const STRING_REQUIRES_EXPR_CONTAINER_PATTERN =
/[\u{0000}-\u{001F}\u{007F}\u{0080}-\u{FFFF}]|"|\\/u;
/[\u{0000}-\u{001F}\u{007F}\u{0080}-\u{FFFF}\u{010000}-\u{10FFFF}]|"|\\/u;
function codegenJsxAttribute(
cx: Context,
attribute: JsxAttribute,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function Component() {
<Text value={'Lauren'} />
<Text value={'சத்யா'} />
<Text value={'Sathya'} />
<Text value={'welcome 👋'} />
</div>
);
}
Expand Down Expand Up @@ -42,6 +43,7 @@ function Component() {
<Text value="Lauren" />
<Text value={"\u0B9A\u0BA4\u0BCD\u0BAF\u0BBE"} />
<Text value="Sathya" />
<Text value={"welcome \uD83D\uDC4B"} />
</div>
);
$[0] = t0;
Expand Down Expand Up @@ -74,4 +76,4 @@ export const FIXTURE_ENTRYPOINT = {

### Eval output
(kind: ok) <div><span>
</span><span>A E</span><span>나은</span><span>Lauren</span><span>சத்யா</span><span>Sathya</span></div>
</span><span>A E</span><span>나은</span><span>Lauren</span><span>சத்யா</span><span>Sathya</span><span>welcome 👋</span></div>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function Component() {
<Text value={'Lauren'} />
<Text value={'சத்யா'} />
<Text value={'Sathya'} />
<Text value={'welcome 👋'} />
</div>
);
}
Expand Down
Loading