Skip to main content

percent_decode

Function percent_decode 

Source
pub fn percent_decode(Input: &str) -> String
Expand description

Decode percent-encoded characters in URI paths. Handles: %20 (space), %23 (#), %25 (%), %5B ([), %5D (]), etc. Decode percent-encoded characters in URI paths, handling multi-byte UTF-8 sequences correctly. Accumulates raw decoded bytes then validates as UTF-8, falling back to lossy conversion for malformed sequences. Casting bytes directly to char (the old approach) corrupts non-ASCII paths: bytes

127 (accented names, CJK, etc.) became private-use codepoints instead of valid UTF-8 characters, causing silent ENOENTs on every file op.