scrivo / highlight.php

A port of highlight.js by Ivan Sagalaev to PHP
BSD 3-Clause "New" or "Revised" License
695 stars 45 forks source link

More fixes for Unicode support #90

Closed allejo closed 3 years ago

allejo commented 3 years ago

Because Unicode support is hard, here's another PR. It also helps to understand how PHP handles UTF-8. All PREG-related functions in PHP will calculate string offsets in bytes and not character lengths; this causes problems because mb_* functions use character lengths.

This also means #88 will need to be reevaluated whenever I get a chance.

Reported in https://github.com/westonruter/syntax-highlighting-code-block/issues/400

/cc @westonruter