Skip to content

Commit 4daf0b4

Browse files
ntkmenex3
andauthored
Escape non-US-ASCII characters in SassException.toCssString() (#2143)
Co-authored-by: Natalie Weizenbaum <nweiz@google.com>
1 parent cd798bf commit 4daf0b4

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
* Produce better output for numbers with complex units in `meta.inspect()` and
44
debugging messages.
55

6+
* When generating CSS error messages to display in-browser, escape all code
7+
points that aren't in the US-ASCII region. Previously only code points U+0100
8+
LATIN CAPITAL LETTER A WITH MACRON were escaped.
9+
610
### JS API
711

812
* Fix a bug where certain exceptions could produce `SourceSpan`s that didn't

lib/src/exception.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ class SassException extends SourceSpanException {
8282
.replaceAll("\r\n", "\n");
8383
term_glyph.ascii = wasAscii;
8484

85-
// For the string comment, render all non-ASCII characters as escape
85+
// For the string comment, render all non-US-ASCII characters as escape
8686
// sequences so that they'll show up even if the HTTP headers are set
8787
// incorrectly.
8888
var stringMessage = StringBuffer();
8989
for (var rune in SassString(toString(color: false)).toString().runes) {
90-
if (rune > 0xFF) {
90+
if (rune > 0x7F) {
9191
stringMessage
9292
..writeCharCode($backslash)
9393
..write(rune.toRadixString(16))

0 commit comments

Comments
 (0)