1ascii85(n)           Text encoding & decoding binary data           ascii85(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       ascii85 - ascii85-encode/decode binary data
9

SYNOPSIS

11       package require Tcl  8.4
12
13       package require ascii85  ?1.0?
14
15       ::ascii85::encode ?-maxlen maxlen? ?-wrapchar wrapchar? string
16
17       ::ascii85::decode string
18
19______________________________________________________________________________
20

DESCRIPTION

22       This package provides procedures to encode binary data into ascii85 and
23       back.
24
25       ::ascii85::encode ?-maxlen maxlen? ?-wrapchar wrapchar? string
26              Ascii85 encodes the given binary string and returns the  encoded
27              result.  Inserts  the character wrapchar every maxlen characters
28              of output. wrapchar defaults to newline. maxlen defaults to 76.
29
30              Note well: If your string is not simple ascii you should fix the
31              string encoding before doing ascii85 encoding. See the examples.
32
33              The  command  will throw an error for negative values of maxlen,
34              or if maxlen is not an integer number.
35
36       ::ascii85::decode string
37              Ascii85 decodes the given string and returns  the  binary  data.
38              The  decoder  ignores  whitespace in the string, as well as tabs
39              and newlines.
40

EXAMPLES

42              % ascii85::encode "Hello, world"
43              87cURD_*#TDfTZ)
44
45
46
47              % ascii85::encode [string repeat xyz 24]
48              G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G
49              ^4U[H$X^\H?a^]
50              % ascii85::encode -wrapchar "" [string repeat xyz 24]
51              G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]G^4U[H$X^\H?a^]
52
53
54
55              # NOTE: ascii85 encodes BINARY strings.
56              % set chemical [encoding convertto utf-8 "C\u2088H\u2081\u2080N\u2084O\u2082"]
57              % set encoded [ascii85::encode $chemical]
58              6fN]R8E,5Pidu\UiduhZidua
59              % set caffeine [encoding convertfrom utf-8 [ascii85::decode $encoded]]
60
61

REFERENCES

63       [1]    http://en.wikipedia.org/wiki/Ascii85
64
65       [2]    Postscript Language Reference Manual,  3rd  Edition,  page  131.
66              http://www.adobe.com/devnet/postscript/pdfs/PLRM.pdf
67

BUGS, IDEAS, FEEDBACK

69       This  document,  and the package it describes, will undoubtedly contain
70       bugs and other problems.  Please report such in the category base64  of
71       the  Tcllib  Trackers  [http://core.tcl.tk/tcllib/reportlist].   Please
72       also report any ideas for enhancements you may have for either  package
73       and/or documentation.
74
75       When proposing code changes, please provide unified diffs, i.e the out‐
76       put of diff -u.
77
78       Note further that  attachments  are  strongly  preferred  over  inlined
79       patches.  Attachments  can  be  made  by  going to the Edit form of the
80       ticket immediately after its creation, and  then  using  the  left-most
81       button in the secondary navigation bar.
82

KEYWORDS

84       ascii85, encoding
85

CATEGORY

87       Text processing
88
90       Copyright (c) 2010, Emiliano Gavilán
91
92
93
94
95tcllib                                1.0                           ascii85(n)
Impressum