Backwards-compatible string encoding