Fix char code escapes and add tests