Completed unescaping algorithm