Fix bug with too aggressive Unicode escape sequences

Fix bug with too aggressive Unicode escape sequences

Fixes #1308
Not sure if this is the best way to solve it, doesn't feel super elegant. Suggestions welcome.