Skip to content
Snippets Groups Projects
Commit bbf1c52252ae authored by Mitchell Kember's avatar Mitchell Kember
Browse files

rust: add encoding.rs

This is based on encoding.py. It reads the environment variables HGENCODING,
HGENCODINGMODE, and HGENCODINGAMBIGUOUS. Currently it only supports UTF-8 and
ascii, but it could be extended to support other local encodings.

Unlike Python, it assumes all internal strings are UTF-8 and does not attempt to
fallback to latin-1 (or ui.fallbackencoding).

Nothing is using this now, but in the future command output and error messages
should transition to using it.

I replaced existing calls to `utf8_to_local` and `local_to_uf8` with direct
String/bytes methods since they were not logically converting between internal
and local encodings. Instead, they were used (for example) when an error message
happened to be stored as String but needed to be passed somewhere as bytes. The
proper fix for this will be to avoid String in the first place.
parent 1b7a57a5b47a
No related branches found
No related tags found
3 merge requests!1292Draft: 7.0rc preparation,!1239annotate: fix ancestor check starting revision,!1179rhg: implement rhg annotate
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment