View Source Pop3mail.WordDecoder (pop3mail v1.5.0)

Decode words as defined in RFC 2047.

Summary

Functions

Decode a text with possibly encoded-words. Returns a list with tuples {charset, text}. Not encoded text is returned with us-ascii charset.

Decode a word. text with possibly encoded-words. Returns a list with tuples {charset, text}. Not encoded text is returned with us-ascii charset.

Decode a word with the given encoding.

Concat the text from the decoded list. Does NOT convert to a common character set like utf-8.

returns sorted unique list of charsets.

Functions

@spec decode_text(String.t()) :: [{String.t(), binary()}]

Decode a text with possibly encoded-words. Returns a list with tuples {charset, text}. Not encoded text is returned with us-ascii charset.

@spec decode_word(String.t()) :: {String.t(), binary()}

Decode a word. text with possibly encoded-words. Returns a list with tuples {charset, text}. Not encoded text is returned with us-ascii charset.

Link to this function

decode_word(text, encoding)

View Source
@spec decode_word(String.t(), <<_::8>>) :: binary()

Decode a word with the given encoding.

encoding - B/Q B=base64 encoded, Q=Quoted-printable

Link to this function

decoded_text_list_to_string(decoded_text_list, add_charset_name \\ false)

View Source
@spec decoded_text_list_to_string([{String.t(), String.t()}], boolean()) :: String.t()

Concat the text from the decoded list. Does NOT convert to a common character set like utf-8.

  • decoded_text_list - list with tuples {charset, text}.
  • add_charset_name - put the name of the charset after the decoded text parts (when it isn't us-ascii). A hint for the reader if a text contains multiple charsets.
Link to this function

get_charsets_besides_ascii(decoded_text_list)

View Source
@spec get_charsets_besides_ascii([{String.t(), String.t()}]) :: [{String.t()}]

returns sorted unique list of charsets.

Because the non-encoded text has the us-ascii charset (a subset of utf-8 iso-8859-1 cp1251) we are particulary interested in the other charsets.

decoded_text_list - list with tuples {charset, text}.