ported patch for unicode() from master