Use multibyte substr and strlen functions

Fixes spans being positioned incorrectly after multibyte characters
Merge pull request #36 from tremby/bugfix/handle-multibyte-characters

Use multibyte substr and strlen functions