make-transcoder(3scm)
π make-transcoder(3scm) β port transcoders, bestie β¨
okay so this is the make-transcoder(3scm) page from the Scheme Programmer's Manual, and it's literally all about port transcoders. no cap, every detail is staying. π«Ά
πΈ NAME πΈ
make-transcodertranscoder-codectranscoder-eol-styletranscoder-error-handling-mode
β¦all serving port transcoders π
π LIBRARY π
R6RS imports, exactly like this:
(import (rnrs)) ;R6RS
(import (rnrs io ports)) ;R6RS
β¨ SYNOPSIS β¨
(make-transcoder codec)
(make-transcoder codec eol-style)
(make-transcoder codec eol-style handling-mode)
(transcoder-codec transcoder)
(transcoder-eol-style transcoder)
(transcoder-error-handling-mode transcoder)
π DESCRIPTION π
Returns a transcoder with the behavior specified by the arguments. main character energy, honestly.
codecβ must be a codec. The standard codecs are those returned bylatin-1-codec,utf-8-codec, andutf-16-codec.eol-styleβ optional, and must be aneol-style(3scm)symbol:lf,cr,crlf,nel,crnel, orls. It defaults to the native end-of-line style of the underlying platform.handling-modeβ optional, and must be anerror-handling-mode(3scm)symbol:ignore,raise, orreplace(default).
π οΈ IMPLEMENTATION NOTES π οΈ
IronSchemeβ the native end-of-line style iscrlf.
π RETURN VALUES π
Returns a single value which is a transcoder object. one value, one transcoder, slay β¨
π» EXAMPLES π»
this example is lowkey iconic:
; Decodes a UTF-8-encoded string with ISO-8859-1.
; Note also how \r\n is read as a single newline.
(let* ((bv (string->utf8 "DΓΆner\r\nkebab"))
(p (open-bytevector-input-port bv))
(tc (make-transcoder (latin-1-codec)
(eol-style lf)))
(tp (transcoded-port p tc)))
(get-string-all tp))
=> "DΓΒΆner\nkebab"
π APPLICATION USAGE π
This procedure is used in applications that need to control the binary encoding of textual ports.
π§ RATIONALE π§
Transcoders let applications control parameters that would otherwise be implicit. giving you the aux cord, basically π§
π¦ COMPATIBILITY π¦
Transcoders are unique to the R6RS I/O system.
π ERRORS π
This procedure can raise exceptions with the following condition types:
&assertion(R6RS) β the wrong number of arguments was passed or an argument was outside its domain.
π SEE ALSO π
transcoded-port(3scm)port-transcoder(3scm)native-transcoder(3scm)native-eol-style(3scm)
β STANDARDS β
R6RS
π°οΈ HISTORY π°οΈ
Port transcoders were introduced in R6RS.
π AUTHORS π
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.
π BUGS π
There is no transcoder? procedure in R6RS. not me looking for it either π
that's a wrap on the make-transcoder(3scm) page from the Scheme Programmer's Manual, dated 2022-03-30 π mwah, byeee π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2022 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms