1 2[//000000001]: # (ascii85 \- Text encoding & decoding binary data) 3[//000000002]: # (Generated from file 'ascii85\.man' by tcllib/doctools with format 'markdown') 4[//000000003]: # (Copyright © 2010, Emiliano Gavilán) 5[//000000004]: # (ascii85\(n\) 1\.0 tcllib "Text encoding & decoding binary data") 6 7<hr> [ <a href="../../../../toc.md">Main Table Of Contents</a> | <a 8href="../../../toc.md">Table Of Contents</a> | <a 9href="../../../../index.md">Keyword Index</a> | <a 10href="../../../../toc0.md">Categories</a> | <a 11href="../../../../toc1.md">Modules</a> | <a 12href="../../../../toc2.md">Applications</a> ] <hr> 13 14# NAME 15 16ascii85 \- ascii85\-encode/decode binary data 17 18# <a name='toc'></a>Table Of Contents 19 20 - [Table Of Contents](#toc) 21 22 - [Synopsis](#synopsis) 23 24 - [Description](#section1) 25 26 - [EXAMPLES](#section2) 27 28 - [References](#section3) 29 30 - [Bugs, Ideas, Feedback](#section4) 31 32 - [Keywords](#keywords) 33 34 - [Category](#category) 35 36 - [Copyright](#copyright) 37 38# <a name='synopsis'></a>SYNOPSIS 39 40package require Tcl 8\.4 41package require ascii85 ?1\.0? 42 43[__::ascii85::encode__ ?__\-maxlen__ *maxlen*? ?__\-wrapchar__ *wrapchar*? *string*](#1) 44[__::ascii85::decode__ *string*](#2) 45 46# <a name='description'></a>DESCRIPTION 47 48This package provides procedures to encode binary data into ascii85 and back\. 49 50 - <a name='1'></a>__::ascii85::encode__ ?__\-maxlen__ *maxlen*? ?__\-wrapchar__ *wrapchar*? *string* 51 52 Ascii85 encodes the given binary *string* and returns the encoded result\. 53 Inserts the character *wrapchar* every *maxlen* characters of output\. 54 *wrapchar* defaults to newline\. *maxlen* defaults to __76__\. 55 56 *Note well*: If your string is not simple ascii you should fix the string 57 encoding before doing ascii85 encoding\. See the examples\. 58 59 The command will throw an error for negative values of *maxlen*, or if 60 *maxlen* is not an integer number\. 61 62 - <a name='2'></a>__::ascii85::decode__ *string* 63 64 Ascii85 decodes the given *string* and returns the binary data\. The 65 decoder ignores whitespace in the string, as well as tabs and newlines\. 66 67# <a name='section2'></a>EXAMPLES 68 69 % ascii85::encode "Hello, world" 70 87cURD_*#TDfTZ) 71 72 % ascii85::encode [string repeat xyz 24] 73 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 74 ^4U[H$X^\H?a^] 75 % ascii85::encode -wrapchar "" [string repeat xyz 24] 76 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^] 77 78 # NOTE: ascii85 encodes BINARY strings. 79 % set chemical [encoding convertto utf-8 "C\u2088H\u2081\u2080N\u2084O\u2082"] 80 % set encoded [ascii85::encode $chemical] 81 6fN]R8E,5Pidu\UiduhZidua 82 % set caffeine [encoding convertfrom utf-8 [ascii85::decode $encoded]] 83 84# <a name='section3'></a>References 85 86 1. [http://en\.wikipedia\.org/wiki/Ascii85](http://en\.wikipedia\.org/wiki/Ascii85) 87 88 1. Postscript Language Reference Manual, 3rd Edition, page 131\. 89 [http://www\.adobe\.com/devnet/postscript/pdfs/PLRM\.pdf](http://www\.adobe\.com/devnet/postscript/pdfs/PLRM\.pdf) 90 91# <a name='section4'></a>Bugs, Ideas, Feedback 92 93This document, and the package it describes, will undoubtedly contain bugs and 94other problems\. Please report such in the category *base64* of the [Tcllib 95Trackers](http://core\.tcl\.tk/tcllib/reportlist)\. Please also report any ideas 96for enhancements you may have for either package and/or documentation\. 97 98When proposing code changes, please provide *unified diffs*, i\.e the output of 99__diff \-u__\. 100 101Note further that *attachments* are strongly preferred over inlined patches\. 102Attachments can be made by going to the __Edit__ form of the ticket 103immediately after its creation, and then using the left\-most button in the 104secondary navigation bar\. 105 106# <a name='keywords'></a>KEYWORDS 107 108[ascii85](\.\./\.\./\.\./\.\./index\.md\#ascii85), 109[encoding](\.\./\.\./\.\./\.\./index\.md\#encoding) 110 111# <a name='category'></a>CATEGORY 112 113Text processing 114 115# <a name='copyright'></a>COPYRIGHT 116 117Copyright © 2010, Emiliano Gavilán 118