Open kugland opened 2 years ago
Hi and welcome, thanks for having a look at unescaping!
While you are technically right that inputs could be in non-UTF8 encodings, unless you have a very real and compelling usecase involving such inputs, it's reasonable to use str
/String
here. In the context of Rust and systemd in 2021, it is fair to make such assumptions about non-legacy environments.
Same goes for Path
: as we can assume the target environment is a modern Linux, there is little to no interest for non-UNIX separators and weird encodings.
While implementing unescaping for systemd-escape strings, I figured out that both the escaping and unescaping should take OsStr, not str, since those strings are not necessarily UTF-8. Do you thing that is doable? Also, the functions for escaping/unescaping paths should probably take &Path, but OsStr should be OK too.
Also, if I submit my unescaping function as a pull request, would you consider merging it?
Thanks, André Kugland