Fix str-slice() with astral plane characters

Closes #732
This commit is contained in:
Natalie Weizenbaum 2019-07-02 16:30:59 -07:00
parent 2105a138c0
commit 40df8e3bc1
2 changed files with 5 additions and 1 deletions

View File

@ -22,6 +22,10 @@
* The `alpha()` function now produces clearer error messages when the wrong
number of arguments are passed.
* Fix a bug where the `str-slice()` function could produce invalid output when
passed a string that contains characters that aren't represented as a single
byte in UTF-16.
## 1.22.2
### JavaScript API

View File

@ -113,7 +113,7 @@ final _slice =
return SassString(
string.text.substring(
codepointIndexToCodeUnitIndex(string.text, startCodepoint),
codepointIndexToCodeUnitIndex(string.text, endCodepoint) + 1),
codepointIndexToCodeUnitIndex(string.text, endCodepoint + 1)),
quotes: string.hasQuotes);
});