From ef35e70446e492f80e8c040ea0d07c950a1f8e94 Mon Sep 17 00:00:00 2001 From: boatbomber Date: Mon, 1 Jun 2026 19:55:52 -0700 Subject: [PATCH] Revert the utf8 path change --- src/path_serializer.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/path_serializer.rs b/src/path_serializer.rs index 4a38698c..2ddd3a4e 100644 --- a/src/path_serializer.rs +++ b/src/path_serializer.rs @@ -7,12 +7,13 @@ use serde::{ser::SerializeSeq, Serialize, Serializer}; /// Converts the provided value into a String with all directory separators /// converted into `/`. -/// -/// Paths that contain invalid Unicode are converted lossily (invalid sequences -/// become the replacement character), since such paths cannot be represented -/// faithfully in a UTF-8 string regardless. pub fn display_absolute>(path: T) -> String { - path.as_ref().to_string_lossy().replace('\\', "/") + let as_str = path + .as_ref() + .as_os_str() + .to_str() + .expect("Invalid Unicode in file path, cannot serialize"); + as_str.replace('\\', "/") } /// A serializer for serde that serialize a value with all directory separators