compact_str icon indicating copy to clipboard operation
compact_str copied to clipboard

feat: Implement the from_utf16_lossy(...) API

Open ParkMyCar opened this issue 2 years ago • 5 comments

This issue for tracking the implementation of the from_utf16_lossy(...) method that exists on String.

ParkMyCar avatar Jun 30 '22 01:06 ParkMyCar

String has only one method for this, but shouldn't it be three methods? UTF-16 in native, little and big endian.

Kijewski avatar Aug 13 '22 00:08 Kijewski

Great point, lets do it! What do you think about supporting the following 6 APIs:

  1. from_utf16(...) (native endianness)
  2. from_utf16_lossy(...) (native endianness)
  3. from_utf16_be(...)
  4. from_utf16_be_lossy(...)
  5. from_utf16_le(...)
  6. from_utf16_le_lossy(...)

ParkMyCar avatar Aug 13 '22 17:08 ParkMyCar

Side note: looks like @CAD97 has a PR to introduce this to the stdlib too! https://github.com/rust-lang/rust/pull/95967

ParkMyCar avatar Aug 13 '22 17:08 ParkMyCar

Also cc @NobodyXu, any thoughts here?

ParkMyCar avatar Aug 13 '22 18:08 ParkMyCar

Also cc @NobodyXu, any thoughts here?

I'm not that familiar with utf16 APIs, but this looks alright to me.

NobodyXu avatar Aug 14 '22 03:08 NobodyXu