Mercurial > hg
diff rust/rhg/src/ui.rs @ 45528:66756b34c06e
rhg: add a `DebugData` `Command` to prepare the `rhg debugdata` subcommand
Differential Revision: https://phab.mercurial-scm.org/D8960
author | Antoine Cezar <antoine.cezar@octobus.net> |
---|---|
date | Wed, 09 Sep 2020 12:07:05 +0200 |
parents | a6a000ab135b |
children | fada33872b5b |
line wrap: on
line diff
--- a/rust/rhg/src/ui.rs Thu Aug 13 16:22:15 2020 +0200 +++ b/rust/rhg/src/ui.rs Wed Sep 09 12:07:05 2020 +0200 @@ -1,3 +1,4 @@ +use std::borrow::Cow; use std::io; use std::io::{ErrorKind, Write}; @@ -103,3 +104,10 @@ } Err(UiError::StdoutError(error)) } + +/// Encode rust strings according to the user system. +pub fn utf8_to_local(s: &str) -> Cow<[u8]> { + // TODO encode for the user's system // + let bytes = s.as_bytes(); + Cow::Borrowed(bytes) +}