changeset 45528 | 66756b34c06e |
parent 45440 | a6a000ab135b |
child 45984 | fada33872b5b |
--- 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) +}