Crate latin1str

source ·
Expand description

latin1str

This crate is a thin wrapper around encoding_rs that provides types to work with WINDOWS-1252 (aka Latin-1) encoded strings.

The main points about these types is that they:

  • Are not nul-terminated
  • Contain no nul-bytes
  • Are infallibly convertible to UTF-8
  • Are infallibly convertible from ASCII
  • Are infallibly convertible from a [u8]

You can use this if none of the following alternatives fit:

  • CStr, which requires trailing nul-bytes
  • str, which is UTF-8 encoded
  • [u8], which lacks a defined encoding

There are two types provided:

Structs

A borrowed latin-1 encoded string (like &str)
An owned latin-1 encoded string