internal/encoder
/ Email content encoding utilities for MIME messages. / This module provides functions for encoding email addresses and strings / using various MIME content transfer encodings such as Base64, Quoted-Printable, / and others defined in RFC standards.
Values
pub fn determine_encoding_order(
order encodings: List(encoding.Encoding),
encode string: String,
with mode: encoding.EncodingMode,
maximum_size maximum_size: Int,
) -> List(encoding.Encoding)
Determines the optimal order of encodings to try for encoding a string within a size limit.
Estimates the encoded size for each encoding and returns them sorted by size from smallest to largest, filtering out encodings that would exceed the maximum size. This is useful for content negotiation to find the most efficient encoding.
pub fn encode_email_address(
email address: String,
with mode: encoding.EncodingMode,
) -> Result(String, encoding.EncoderError)
Encodes an email address using IDNA (Internationalized Domain Names in Applications).
pub fn encode_string(
encode string: String,
using encoding: encoding.Encoding,
with mode: encoding.EncodingMode,
start position: Int,
preferred_size preferred_size: Int,
maximum_size maximum_size: Int,
) -> Result(List(String), encoding.EncoderError)
Encodes a string using the specified content transfer encoding.
This function delegates to the appropriate encoder based on the encoding type.
pub fn name(encoding: encoding.Encoding) -> String
Returns the canonical string name for an encoding type.