Get the canonical name of this encoding. Returns a string suitable for display or serialization.
(&self)
| 192 | /// |
| 193 | /// Returns a string suitable for display or serialization. |
| 194 | pub fn name(&self) -> &'static str { |
| 195 | match self { |
| 196 | Encoding::Utf8 => "UTF-8", |
| 197 | Encoding::Utf16Le => "UTF-16LE", |
| 198 | Encoding::Utf16Be => "UTF-16BE", |
| 199 | Encoding::Latin1 => "ISO-8859-1", |
| 200 | Encoding::Binary => "binary", |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | /// Parse an encoding from its name. |
| 205 | /// |