authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2024-02-14 14:56:36-08:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2024-02-24 14:05:24-08:00
log9fec608b3bbe3c00528e01bd09aa29f9b9f97415
tree0f273b2755f798eccc22f3b33715469c064d965f
parentabd250bb9c94923cc27ce1b09e6113845b7021fa

Add std.fs.path.fmtAsUtf8Lossy/fmtWtf16LeAsUtf8Lossy


1 files changed, 15 insertions(+), 0 deletions(-)

lib/std/fs/path.zig+15
......@@ -1939,3 +1939,18 @@ test "ComponentIterator roots" {
19391939 try std.testing.expectEqualStrings("//a/b//", it.root().?);
19401940 }
19411941}
1942
1943/// Format a path encoded as bytes for display as UTF-8.
1944/// Returns a Formatter for the given path. The path will be converted to valid UTF-8
1945/// during formatting. This is a lossy conversion if the path contains any ill-formed UTF-8.
1946/// Ill-formed UTF-8 byte sequences are replaced by the replacement character (U+FFFD)
1947/// according to "U+FFFD Substitution of Maximal Subparts" from Chapter 3 of
1948/// the Unicode standard, and as specified by https://encoding.spec.whatwg.org/#utf-8-decoder
1949pub const fmtAsUtf8Lossy = std.unicode.fmtUtf8;
1950
1951/// Format a path encoded as WTF-16 LE for display as UTF-8.
1952/// Return a Formatter for a (potentially ill-formed) UTF-16 LE path.
1953/// The path will be converted to valid UTF-8 during formatting. This is
1954/// a lossy conversion if the path contains any unpaired surrogates.
1955/// Unpaired surrogates are replaced by the replacement character (U+FFFD).
1956pub const fmtWtf16LeAsUtf8Lossy = std.unicode.fmtUtf16Le;