How Lexopt handles Unicode and OsString
masterLexopt is designed to be pedantic and correct regarding character encoding:
- OsString: Arguments are returned as
OsStringto allow handling of non-Unicode filenames or arguments safely. - Conversion: Use
.string()to decode anOsStringinto aString(which may fail if not valid UTF-8) or use thelexopt::preludeto access.parse()for types that implementFromStr. - Unicode Support: The library supports Unicode. Short options must be a single Unicode codepoint (
char). - Robustness: Options can be combined with non-Unicode arguments without error. If an option name itself is not valid Unicode, it is patched using
String::from_utf8_lossyand will likely result in an unrecognized argument error.