1uuencode(n) Text encoding & decoding binary data uuencode(n)
2
3
4
5______________________________________________________________________________
6
8 uuencode - UU-encode/decode binary data
9
11 package require Tcl 8
12
13 package require uuencode ?1.1.4?
14
15 ::uuencode::encode string
16
17 ::uuencode::decode string
18
19 ::uuencode::uuencode ?-name string? ?-mode octal? (-file filename |
20 ?--? string)
21
22 ::uuencode::uudecode (-file filename | ?--? string)
23
24______________________________________________________________________________
25
27 This package provides a Tcl-only implementation of the uuencode(1) and
28 uudecode(1) commands. This encoding packs binary data into printable
29 ASCII characters.
30
31 ::uuencode::encode string
32 returns the uuencoded data. This will encode all the data passed
33 in even if this is longer than the uuencode maximum line length.
34 If the number of input bytes is not a multiple of 3 then addi‐
35 tional 0 bytes are added to pad the string.
36
37 ::uuencode::decode string
38 Decodes the given encoded data. This will return any padding
39 characters as well and it is the callers responsibility to deal
40 with handling the actual length of the encoded data. (see uuen‐
41 code).
42
43 ::uuencode::uuencode ?-name string? ?-mode octal? (-file filename |
44 ?--? string)
45
46 ::uuencode::uudecode (-file filename | ?--? string)
47 UUDecode a file or block of data. A file may contain more than
48 one embedded file so the result is a list where each element is
49 a three element list of filename, mode value and data.
50
52 -filename name
53 Cause the uuencode or uudecode commands to read their data from
54 the named file rather that taking a string parameter.
55
56 -name string
57 The uuencoded data header line contains the suggested file name
58 to be used when unpacking the data. Use this option to change
59 this from the default of "data.dat".
60
61 -mode octal
62 The uuencoded data header line contains a suggested permissions
63 bit pattern expressed as an octal string. To change the default
64 of 0644 you can set this option. For instance, 0755 would be
65 suitable for an executable. See chmod(1).
66
68 % set d [uuencode::encode "Hello World!"]
69 2&5L;&\\@5V]R;&0A
70
71
72 % uuencode::uudecode $d
73 Hello World!
74
75
76 % set d [uuencode::uuencode -name hello.txt "Hello World"]
77 begin 644 hello.txt
78 +2&5L;&\@5V]R;&0`
79 `
80 end
81
82
83 % uuencode::uudecode $d
84 {hello.txt 644 {Hello World}}
85
86
88 This document, and the package it describes, will undoubtedly contain
89 bugs and other problems. Please report such in the category base64 of
90 the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please
91 also report any ideas for enhancements you may have for either package
92 and/or documentation.
93
94 When proposing code changes, please provide unified diffs, i.e the out‐
95 put of diff -u.
96
97 Note further that attachments are strongly preferred over inlined
98 patches. Attachments can be made by going to the Edit form of the
99 ticket immediately after its creation, and then using the left-most
100 button in the secondary navigation bar.
101
103 encoding, uuencode
104
106 Text processing
107
109 Copyright (c) 2002, Pat Thoyts
110
111
112
113
114tcllib 1.1.4 uuencode(n)