Skip to content
Open
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
13 changes: 13 additions & 0 deletions lessc.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1647,6 +1647,14 @@ public function compile($string, $name = null) {
$locale = setlocale(LC_NUMERIC, 0);
setlocale(LC_NUMERIC, "C");

$internal_encoding = NULL;
// only if mbstring installed
if (function_exists('mb_orig_strlen')) {
$internal_encoding = ini_get('mbstring.internal_encoding');
if(!is_null($internal_encoding)){
ini_set('mbstring.internal_encoding', NULL);
}
}
$this->parser = $this->makeParser($name);
$root = $this->parser->parse($string);

Expand All @@ -1666,6 +1674,9 @@ public function compile($string, $name = null) {
$this->formatter->block($this->scope);
$out = ob_get_clean();
setlocale(LC_NUMERIC, $locale);
if(!is_null($internal_encoding)){
ini_set('mbstring.internal_encoding', $internal_encoding);
}
return $out;
}

Expand Down Expand Up @@ -2106,6 +2117,7 @@ public function __construct($lessc, $sourceName = null) {
}

public function parse($buffer) {

$this->count = 0;
$this->line = 1;

Expand All @@ -2126,6 +2138,7 @@ public function parse($buffer) {
$lastCount = $this->count;
while (false !== $this->parseChunk());


if ($this->count != strlen($this->buffer))
$this->throwError();

Expand Down
15 changes: 15 additions & 0 deletions tests/inputs/utf_symbols.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ul {
li {
&:before {
content: "—";
}
}
&:after {
content: "©—©";
}
}
div {
&:before {
content: "Привет, мир!";
}
}
9 changes: 9 additions & 0 deletions tests/outputs/utf_symbols.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ul li:before {
content: "—";
}
ul:after {
content: "©—©";
}
div:before {
content: "Привет, мир!";
}