Implement Debug for EncodeWide by thaliaarchi · Pull Request #140153 · rust-lang/rust (original) (raw)

Here are the options, as I see them. I think formatting them as chars when not surrogates is the most readable for most texts. Rust style seems to lean towards uppercase hex.

  1. EncodeWide([97, 233, 32, 55357, 55357, 56489]): decimal
  2. EncodeWide([0x61, 0xE9, 0x20, 0xD83D, 0xD83D, 0xDCA9]): hex, zero-pad min 2, upper
  3. EncodeWide([0x61, 0xe9, 0x20, 0xd83d, 0xd83d, 0xdca9]): hex, zero-pad min 2, lower
  4. EncodeWide([0x0061, 0x00E9, 0x0020, 0xD83D, 0xD83D, 0xDCA9]): hex, zero-pad min 4, upper
  5. EncodeWide([0x0061, 0x00e9, 0x0020, 0xd83d, 0xd83d, 0xdca9]): hex, zero-pad min 4, lower
  6. EncodeWide(['a', 'é', ' ', '\u{D83D}', '\u{D83D}', '\u{DCA9}']): pseudo-char, escaped surrogates, upper
  7. EncodeWide(['a', 'é', ' ', '\u{d83d}', '\u{d83d}', '\u{dca9}']): pseudo-char, escaped surrogates, lower