D6756: rust-utils: add normalize_case util to mirror Python one

Yuya Nishihara yuya at tcha.org
Sun Sep 1 03:00:18 UTC 2019


> +/// TODO improve handling of utf8 file names. Our overall strategy for
> +/// filenames has to be revisited anyway, since Windows is UTF-16.
> +pub fn normalize_case(bytes: &[u8]) -> Vec<u8> {
> +    #[cfg(windows)] // NTFS compares via upper()
> +    return bytes.to_ascii_uppercase();
> +    #[cfg(unix)]
> +    bytes.to_ascii_lowercase()
> +}

HFS+ has more complex rules, and some were the source of security issue.



More information about the Mercurial-devel mailing list