Skip to content

Commit 1c2fc21

Browse files
authored
fix: allow characters in the supplementary special-purpose plane (#15823)
fixes #15821 Source: https://en.wikipedia.org/wiki/Plane_(Unicode)#Supplementary_Special-purpose_Plane
1 parent 018996c commit 1c2fc21

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.changeset/wild-bulldogs-move.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: allow characters in the supplementary special-purpose plane

packages/svelte/src/compiler/phases/1-parse/utils/html.js

+7
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ const NUL = 0;
7272
// to replace them ourselves
7373
//
7474
// Source: http://en.wikipedia.org/wiki/Character_encodings_in_HTML#Illegal_characters
75+
// Also see: https://en.wikipedia.org/wiki/Plane_(Unicode)
76+
// Also see: https://html.spec.whatwg.org/multipage/parsing.html#preprocessing-the-input-stream
7577

7678
/** @param {number} code */
7779
function validate_code(code) {
@@ -116,5 +118,10 @@ function validate_code(code) {
116118
return code;
117119
}
118120

121+
// supplementary special-purpose plane 0xe0000 - 0xe07f and 0xe0100 - 0xe01ef
122+
if ((code >= 917504 && code <= 917631) || (code >= 917760 && code <= 917999)) {
123+
return code;
124+
}
125+
119126
return NUL;
120127
}

0 commit comments

Comments
 (0)