vector/sources/util/
encoding_config.rs

1use vector_lib::configurable::configurable_component;
2
3/// Character set encoding.
4#[configurable_component]
5#[derive(Clone, Debug, PartialEq, Eq)]
6#[serde(deny_unknown_fields)]
7pub struct EncodingConfig {
8    /// Encoding of the source messages.
9    ///
10    /// Takes one of the encoding [label strings](https://encoding.spec.whatwg.org/#concept-encoding-get) defined as
11    /// part of the [Encoding Standard](https://encoding.spec.whatwg.org/).
12    ///
13    /// When set, the messages are transcoded from the specified encoding to UTF-8, which is the encoding that is
14    /// assumed internally for string-like data. Enable this transcoding operation if you need your data to
15    /// be in UTF-8 for further processing. At the time of transcoding, any malformed sequences (that can't be mapped to
16    /// UTF-8) is replaced with the Unicode [REPLACEMENT
17    /// CHARACTER](https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character) and warnings are
18    /// logged.
19    #[configurable(metadata(docs::examples = "utf-16le"))]
20    #[configurable(metadata(docs::examples = "utf-16be"))]
21    pub charset: &'static encoding_rs::Encoding,
22}