From 86eb2f1dcc407402919ad2f12d2b3461f12799f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=81=A4=E3=81=8D?= Date: Wed, 6 Dec 2023 10:21:29 -0800 Subject: [PATCH 1/2] Escape non-US-ASCII characters in `SassException.toCssString()` --- lib/src/exception.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/exception.dart b/lib/src/exception.dart index 69dbbe7e5..898258c88 100644 --- a/lib/src/exception.dart +++ b/lib/src/exception.dart @@ -82,12 +82,12 @@ class SassException extends SourceSpanException { .replaceAll("\r\n", "\n"); term_glyph.ascii = wasAscii; - // For the string comment, render all non-ASCII characters as escape + // For the string comment, render all non-US-ASCII characters as escape // sequences so that they'll show up even if the HTTP headers are set // incorrectly. var stringMessage = StringBuffer(); for (var rune in SassString(toString(color: false)).toString().runes) { - if (rune > 0xFF) { + if (rune > 0x7F) { stringMessage ..writeCharCode($backslash) ..write(rune.toRadixString(16)) From b2f34ce9429f6942e8c2b33ef12c4abceffe47a7 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Thu, 7 Dec 2023 16:24:35 -0800 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77f7bf3ea..4c6d7da13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## 1.69.6 +* When generating CSS error messages to display in-browser, escape all code + points that aren't in the US-ASCII region. Previously only code points U+0100 + LATIN CAPITAL LETTER A WITH MACRON were escaped. + ### JS API * Fix a bug where certain exceptions could produce `SourceSpan`s that didn't