Ensure frame element names are escaped correctly

When a top-level var or def had a non-ASCII name the slot name was saved
incorrectly, as slot names were escaped using the internal _escape
method rather than proper string escaping. Hexadecimal escape characters
were mangled and would not work where required, and raised errors in
some compilers.