We cannot arbitrarily convert strings to unicode representation as this would
affect their size. Instead, only the unicode portion of a non-wide string must
be encoded. As part of this work the code duplication
unescape_string/unescape_wide_string is resolved. A new regression test confirms
that the previous implementation was broken (and is now fixed).