Re: Guile bindings: decoding Quoted Printable strings.

Sergey Poznyakoff <[email protected]>
Newsgroups gmane.comp.gnu.mailutils.bugs
Organization GNU.org.ua
Message-ID <[email protected]>
Hi Ricardo,

I have implemented the following functions:

* mu-header-decode STR [CHARSET]

Decode the header value STR. Optional CHARSET defaults to "utf-8".
Example:

 (mu-header-decode "=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <[email protected]>")

This is basically what you requested.
 
* mu-header-encode STR [ENCODING [CHARSET]]

Reverse of the above. Encode the string STR as per RFC 2047.
Allowed values for ENCODING are "base64" and "quoted-printable".
Default is selected depending on number of printable characters in str.
Optional CHARSET defaults to "utf-8".

The following two functions provide interface to Mailutils filter
functions, which allow the programmer to perform various conversions
(see http://mailutils.org/wiki/Category:Filters for details):

* mu-encoder-port PORT FILTER . ARGS

Create a port for encoding data using the Mailutils filter FILTER,
with optional arguments ARGS. The PORT argument must be a port opened
either for writing or for reading, but not both. The returned port will
have the same mode as PORT.

Example usage:

  (let ((port (mu-encoder-port (open-file "input" "r") "base64")))
    (do ((line (get-line port) (get-line port)))
        ((eof-object? line) #t)
      (display line)
      (newline)))

This will print on standard output the content of the file "input"
encoded in base64.

* mu-decoder-port PORT NAME . ARGS

Similar to the above, but the returned port will decode the data.

The necessary changes are in git head. Please pull and rebuild. If
you have any difficulty building the git version, let me know and I'll
prepare a tarball for you.

Regards,
Sergey
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.