{"size": 2563, "ext": "scrbl", "max_stars_repo_path": "pkgs/net-doc/net/scribblings/qp.scrbl", "max_stars_repo_name": "lkh01/racket", "max_stars_repo_stars_event_min_datetime": "2018-07-29T04:13:52.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-14T16:11:17.000Z", "max_issues_repo_path": "pkgs/net-doc/net/scribblings/qp.scrbl", "max_issues_repo_name": "lkh01/racket", "max_issues_repo_issues_event_min_datetime": "2017-08-25T20:26:37.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T17:48:40.000Z", "max_forks_repo_path": "pkgs/net-doc/net/scribblings/qp.scrbl", "max_forks_repo_name": "lkh01/racket", "max_forks_repo_forks_event_min_datetime": "2016-04-25T11:47:57.000Z", "max_forks_repo_forks_event_max_datetime": "2017-05-09T14:52:48.000Z"}
{"max_stars_count": 10, "max_issues_count": 15, "max_forks_count": 3, "avg_line_length": 29.125, "max_line_length": 70, "alphanum_fraction": 0.6699180648}
#lang scribble/doc
@(require "common.rkt" (for-label net/qp net/qp-unit net/qp-sig))

@title[#:tag "qp"]{Quoted-Printable: Encoding and Decoding}

@defmodule[net/qp]{The @racketmodname[net/qp] library provides
utilities for quoted-printable (mime-standard) encoding and decoding
from RFC 2045 section 6.7.

The library was written by Francisco Solsona.}

@section[#:tag "qp-procs"]{Functions}

@defproc[(qp-encode [bstr bytes?]) bytes?]{

Consumes a byte string and returns its quoted printable representation
as a new string. The encoded string uses @racket[#"\r\n"] where
necessary to create shorter lines.}


@defproc[(qp-decode [bstr bytes?]) bytes?]{

Consumes a byte string and returns its un-quoted printable
representation as a new string. Non-soft line breaks are preserved in
whatever form they exist (CR, LR, or CRLF) in the input string.}


@defproc[(qp-encode-stream [in input-port?]
                           [out output-port?]
                           [newline-bstr bytes? #"\n"])
         void?]{

Reads characters from @racket[in] and writes the quoted printable
encoded result to @racket[out].

The @racket[newline-bstr] argument is used for soft line-breaks (after
@litchar{=}). Note that the default @racket[newline-bstr] is just
@racket[#"\n"], not @racket[#"\r\n"].

Other line breaks are preserved in whatever form they exist (CR, LR,
or CRLF) in the input stream.}


@defproc[(qp-decode-stream [in input-port?]
                               [out output-port?])
         void?]{

Reads characters from @racket[in] and writes de-quoted-printable
result to @racket[out].  Non-soft line breaks are preserved in
whatever form they exist (CR, LR, or CRLF) in the input stream.}

@; ----------------------------------------

@section[#:tag "qp-exn"]{Exceptions}

@deftogether[(
@defstruct[qp-error ()]
@defstruct[(qp-wrong-input qp-error) ()]
@defstruct[(qp-wrong-line-size qp-error) ()]
)]{

None of these are used anymore, but the bindings are preserved for
backward compatibility.}

@; ----------------------------------------

@section{Quoted-Printable Unit}

@margin-note{@racket[qp@] and @racket[qp^] are deprecated.
They exist for backward-compatibility and will likely be removed in
the future. New code should use the @racketmodname[net/qp] module.}

@defmodule[net/qp-unit]

@defthing[qp@ unit?]{

Imports nothing, exports @racket[qp^].}

@; ----------------------------------------

@section{-Printable Signature}

@defmodule[net/qp-sig]

@defsignature[qp^ ()]{}

Includes everything exported by the @racketmodname[net/qp] module.
