📄 uuencode.html
字号:
<td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="center"><p class="tent"> </p></td></tr><tr valign="top"><td align="left"><p class="tent">9</p></td><td align="center"><p class="tent">J</p></td><td align="left"><p class="tent">26</p></td><td align="left"><p class="tent">a</p></td><td align="center"><p class="tent">43</p></td><td align="left"><p class="tent">r</p></td><td align="left"><p class="tent">60</p></td><td align="center"><p class="tent">8</p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="center"><p class="tent"> </p></td></tr><tr valign="top"><td align="left"><p class="tent">10</p></td><td align="center"><p class="tent">K</p></td><td align="left"><p class="tent">27</p></td><td align="left"><p class="tent">b</p></td><td align="center"><p class="tent">44</p></td><td align="left"><p class="tent">s</p></td><td align="left"><p class="tent">61</p></td><td align="center"><p class="tent">9</p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="center"><p class="tent"> </p></td></tr><tr valign="top"><td align="left"><p class="tent">11</p></td><td align="center"><p class="tent">L</p></td><td align="left"><p class="tent">28</p></td><td align="left"><p class="tent">c</p></td><td align="center"><p class="tent">45</p></td><td align="left"><p class="tent">t</p></td><td align="left"><p class="tent">62</p></td><td align="center"><p class="tent">+</p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="center"><p class="tent"> </p></td></tr><tr valign="top"><td align="left"><p class="tent">12</p></td><td align="center"><p class="tent">M</p></td><td align="left"><p class="tent">29</p></td><td align="left"><p class="tent">d</p></td><td align="center"><p class="tent">46</p></td><td align="left"><p class="tent">u</p></td><td align="left"><p class="tent">63</p></td><td align="center"><p class="tent">/</p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="center"><p class="tent"> </p></td></tr><tr valign="top"><td align="left"><p class="tent">13</p></td><td align="center"><p class="tent">N</p></td><td align="left"><p class="tent">30</p></td><td align="left"><p class="tent">e</p></td><td align="center"><p class="tent">47</p></td><td align="left"><p class="tent">v</p></td><td align="left"><p class="tent"> </p></td><td align="center"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="center"><p class="tent"> </p></td></tr><tr valign="top"><td align="left"><p class="tent">14</p></td><td align="center"><p class="tent">O</p></td><td align="left"><p class="tent">31</p></td><td align="left"><p class="tent">f</p></td><td align="center"><p class="tent">48</p></td><td align="left"><p class="tent">w</p></td><td align="left"><p class="tent">(pad)</p></td><td align="center"><p class="tent">=</p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="center"><p class="tent"> </p></td></tr><tr valign="top"><td align="left"><p class="tent">15</p></td><td align="center"><p class="tent">P</p></td><td align="left"><p class="tent">32</p></td><td align="left"><p class="tent">g</p></td><td align="center"><p class="tent">49</p></td><td align="left"><p class="tent">x</p></td><td align="left"><p class="tent"> </p></td><td align="center"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="center"><p class="tent"> </p></td></tr><tr valign="top"><td align="left"><p class="tent">16</p></td><td align="center"><p class="tent">Q</p></td><td align="left"><p class="tent">33</p></td><td align="left"><p class="tent">h</p></td><td align="center"><p class="tent">50</p></td><td align="left"><p class="tent">y</p></td><td align="left"><p class="tent"> </p></td><td align="center"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="center"><p class="tent"> </p></td></tr></table></center><p>The character referenced by the index shall be placed in the output string.</p><p>The output stream (encoded bytes) shall be represented in lines of no more than 76 characters each. All line breaks or othercharacters not found in the table shall be ignored by decoding software (see <a href="uudecode.html"><i>uudecode</i></a>).</p><p>Special processing shall be performed if fewer than 24 bits are available at the end of a message or encapsulated part of amessage. A full encoding quantum shall always be completed at the end of a message. When fewer than 24 input bits are available inan input group, zero bits shall be added (on the right) to form an integral number of 6-bit groups. Output character positions thatare not required to represent actual input data shall be set to the character <tt>'='</tt>. Since all Base64 input is an integralnumber of octets, only the following cases can arise:</p><ol><li><p>The final quantum of encoding input is an integral multiple of 24 bits; here, the final unit of encoded output shall be anintegral multiple of 4 characters with no <tt>'='</tt> padding.</p></li><li><p>The final quantum of encoding input is exactly 16 bits; here, the final unit of encoded output shall be three charactersfollowed by one <tt>'='</tt> padding character.</p></li><li><p>The final quantum of encoding input is exactly 8 bits; here, the final unit of encoded output shall be two characters followedby two <tt>'='</tt> padding characters.</p></li></ol><p>A terminating <tt>"===="</tt> evaluates to nothing and denotes the end of the encoded data.</p><h5><a name="tag_04_163_10_02"></a>uuencode Historical Algorithm</h5><p>The standard output shall be a text file (encoded in the character set of the current locale) that begins with the line:</p><pre><tt>"begin<img src="../images/delta.gif" border="0">%s<img src="../images/delta.gif" border="0">%s\n" <</tt><i>mode</i><tt>>, <</tt><i>decode_pathname</i><tt>></tt></pre><p>and ends with the line:</p><pre><tt>"end\n"</tt></pre><p>In both cases, the lines shall have no preceding or trailing <blank>s.</p><p>The algorithm that shall be used for lines in between <b>begin</b> and <b>end</b> takes three octets as input and writes fourcharacters of output by splitting the input at six-bit intervals into four octets, containing data in the lower six bits only.These octets shall be converted to characters by adding a value of 0x20 to each octet, so that each octet is in the range[0x20,0x5f], and then it shall be assumed to represent a printable character in the ISO/IEC 646:1991 standard encodedcharacter set. It then shall be translated into the corresponding character codes for the codeset in use in the current locale.(For example, the octet 0x41, representing <tt>'A'</tt>, would be translated to <tt>'A'</tt> in the current codeset, such as 0xc1if it were EBCDIC.)</p><p>Where the bits of two octets are combined, the least significant bits of the first octet shall be shifted left and combined withthe most significant bits of the second octet shifted right. Thus the three octets <i>A</i>, <i>B</i>, <i>C</i> shall be convertedinto the four octets:</p><pre><tt>0x20 + (( A >> 2 ) & 0x3F)0x20 + (((A << 4) | ((B >> 4) & 0xF)) & 0x3F)0x20 + (((B << 2) | ((C >> 6) & 0x3)) & 0x3F)0x20 + (( C ) & 0x3F)</tt></pre><p>These octets then shall be translated into the local character set.</p><p>Each encoded line contains a length character, equal to the number of characters to be decoded plus 0x20 translated to the localcharacter set as described above, followed by the encoded characters. The maximum number of octets to be encoded on each line shallbe 45.</p></blockquote><h4><a name="tag_04_163_11"></a>STDERR</h4><blockquote><p>The standard error shall be used only for diagnostic messages.</p></blockquote><h4><a name="tag_04_163_12"></a>OUTPUT FILES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_163_13"></a>EXTENDED DESCRIPTION</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_163_14"></a>EXIT STATUS</h4><blockquote><p>The following exit values shall be returned:</p><dl compact><dt> 0</dt><dd>Successful completion.</dd><dt>>0</dt><dd>An error occurred.</dd></dl></blockquote><h4><a name="tag_04_163_15"></a>CONSEQUENCES OF ERRORS</h4><blockquote><p>Default.</p></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_04_163_16"></a>APPLICATION USAGE</h4><blockquote><p>The file is expanded by 35 percent (each three octets become four, plus control information) causing it to take longer totransmit.</p><p>Since this utility is intended to create files to be used for data interchange between systems with possibly different codesets,and to represent binary data as a text file, the ISO/IEC 646:1991 standard was chosen for a midpoint in the algorithm as aknown reference point. The output from <i>uuencode</i> is a text file on the local system. If the output were in theISO/IEC 646:1991 standard codeset, it might not be a text file (at least because the <newline>s might not match), andthe goal of creating a text file would be defeated. If this text file was then carried to another machine with the same codeset, itwould be perfectly compatible with that system's <a href="../utilities/uudecode.html"><i>uudecode</i></a>. If it was transmittedover a mail system or sent to a machine with a different codeset, it is assumed that, as for every other text file, sometranslation mechanism would convert it (by the time it reached a user on the other system) into an appropriate codeset. Thistranslation only makes sense from the local codeset, not if the file has been put into a ISO/IEC 646:1991 standardrepresentation first. Similarly, files processed by <i>uuencode</i> can be placed in <a href="../utilities/pax.html"><i>pax</i></a>archives, intermixed with other text files in the same codeset.</p></blockquote><h4><a name="tag_04_163_17"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_163_18"></a>RATIONALE</h4><blockquote><p>A new algorithm was added at the request of the international community to parallel work in RFC 2045 (MIME). As with thehistorical <i>uuencode</i> format, the Base64 Content-Transfer-Encoding is designed to represent arbitrary sequences of octets in aform that is not humanly readable. A 65-character subset of the ISO/IEC 646:1991 standard is used, enabling 6 bits to berepresented per printable character. (The extra 65th character, <tt>'='</tt>, is used to signify a special processingfunction.)</p><p>This subset has the important property that it is represented identically in all versions of the ISO/IEC 646:1991 standard,including US ASCII, and all characters in the subset are also represented identically in all versions of EBCDIC. The historical<i>uuencode</i> algorithm does not share this property, which is the reason that a second algorithm was added to theISO POSIX-2 standard.</p><p>The string <tt>"===="</tt> was used for the termination instead of the end used in the original format because the latter is astring that could be valid encoded input.</p><p>In an early draft, the <b>-m</b> option was named <b>-b</b> (for Base64), but it was renamed to reflect its relationship to theRFC 2045. A <b>-u</b> was also present to invoke the default algorithm, but since this was not historical practice, it wasomitted as being unnecessary.</p><p>See the RATIONALE section in <a href="uudecode.html"><i>uudecode</i></a> for the derivation of the <b>/dev/stdout</b>symbol.</p></blockquote><h4><a name="tag_04_163_19"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_163_20"></a>SEE ALSO</h4><blockquote><p><a href="chmod.html"><i>chmod</i>()</a>, <a href="mailx.html"><i>mailx</i></a>, <a href="uudecode.html"><i>uudecode</i></a></p></blockquote><h4><a name="tag_04_163_21"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 4.</p></blockquote><h4><a name="tag_04_163_22"></a>Issue 6</h4><blockquote><p>This utility is marked as part of the User Portability Utilities option.</p><p>The Base64 algorithm and the ability to output to <b>/dev/stdout</b> are added as specified in the IEEE P1003.2b draftstandard.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX ® is a registered Trademark of The Open Group.<br>POSIX ® is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -