跳转到内容

Uuencode:修订间差异

维基百科,自由的百科全书
删除的内容 添加的内容
Greener留言 | 贡献
Greener留言 | 贡献
无编辑摘要
第1行: 第1行:
{{translation||tfrom=[[:en:UUencode]]|tpercent=10}}
{{translation||tfrom=[[:en:UUencode]]|tpercent=70}}


'''uuencode'''這個名字是衍生自 "Unix-to-Unix encoding",原先是[[Unix]]系統下將[[二進位數字系統|二進位]]的資料藉由[[uucp]]郵件系統傳輸的一個[[編碼]]程式,是一種[[二進位到文字的編碼]] 。'''uudecode''' 是與uuencode搭配的解碼程式,uuencode/decode常見於[[電子郵件]]中的檔案傳送以及[[usenet]]新聞群組的貼文等等。近來以被[[MIME]]這種編碼程序大量取代.
'''uuencode'''這個名字是衍生自 "Unix-to-Unix encoding",原先是[[Unix]]系統下將[[二進位數字系統|二進位]]的資料藉由[[uucp]]郵件系統傳輸的一個[[編碼]]程式,是一種[[二進位到文字的編碼]] 。'''uudecode''' 是與uuencode搭配的解碼程式,uuencode/decode常見於[[電子郵件]]中的檔案傳送以及[[usenet]]新聞群組的貼文等等。近來以被[[MIME]]這種編碼程序大量取代.
第99行: 第99行:


==Uuencode對照表==
==Uuencode對照表==
下面的表格顯示uuencode所使用到的ASCII字元集、6-bit二進位碼以及十進位的對照。由上面''Cat''的例子可以看出其第一個編碼為十進位的16,對應下面表格''uuencode十進位表示''欄位,可以查出其uuencode的輸出碼為''0''。
The following table represents the subset of ASCII characters used by UUEncode and the 6-bit binary string they represent.


{| border="1" cellpadding="2" cellspacing="0"
{| border="1" cellpadding="2" cellspacing="0"
|- valign="bottom"
|- valign="bottom"
!可列印的字元
!Printable<br />Representation
!ASCII Decimal
!十進位ASCII
!uuencode</br>二進位表示
!Binary<br />Representation
!uuencode</br>十進位表示
!
!
!可列印的字元
!Printable<br />Representation
!ASCII Decimal
!十進位ASCII
!uuencode</br>二進位表示
!Binary<br />Representation
!uuencode</br>十進位表示
|-
|-
|-
|-
第115行: 第117行:
|align="center"|32
|align="center"|32
|align="center"|000 000
|align="center"|000 000
|align="center"|0
|&nbsp;
|&nbsp;
|align="center"|@
|align="center"|@
|align="center"|64
|align="center"|64
|align="center"|100 000
|align="center"|100 000
|align="center"|32
|-
|-
|align="center"|!
|align="center"|!
|align="center"|33
|align="center"|33
|align="center"|000 001
|align="center"|000 001
|align="center"|1
|&nbsp;
|&nbsp;
|align="center"|A
|align="center"|A
|align="center"|65
|align="center"|65
|align="center"|100 001
|align="center"|100 001
|align="center"|33
|-
|-
|align="center"|"
|align="center"|"
|align="center"|34
|align="center"|34
|align="center"|000 010
|align="center"|000 010
|align="center"|2
|&nbsp;
|&nbsp;
|align="center"|B
|align="center"|B
|align="center"|66
|align="center"|66
|align="center"|100 010
|align="center"|100 010
|align="center"|34
|-
|-
|align="center"|#
|align="center"|#
|align="center"|35
|align="center"|35
|align="center"|000 011
|align="center"|000 011
|align="center"|3
|&nbsp;
|&nbsp;
|align="center"|C
|align="center"|C
|align="center"|67
|align="center"|67
|align="center"|100 011
|align="center"|100 011
|align="center"|35
|-
|-
|align="center"|$
|align="center"|$
|align="center"|36
|align="center"|36
|align="center"|000 100
|align="center"|000 100
|align="center"|4
|&nbsp;
|&nbsp;
|align="center"|D
|align="center"|D
|align="center"|68
|align="center"|68
|align="center"|100 100
|align="center"|100 100
|align="center"|36
|-
|-
|align="center"|%
|align="center"|%
|align="center"|37
|align="center"|37
|align="center"|000 101
|align="center"|000 101
|align="center"|5
|&nbsp;
|&nbsp;
|align="center"|E
|align="center"|E
|align="center"|69
|align="center"|69
|align="center"|100 101
|align="center"|100 101
|align="center"|37
|-
|-
|align="center"|&
|align="center"|&
|align="center"|38
|align="center"|38
|align="center"|000 110
|align="center"|000 110
|align="center"|6
|&nbsp;
|&nbsp;
|align="center"|F
|align="center"|F
|align="center"|70
|align="center"|70
|align="center"|100 110
|align="center"|100 110
|align="center"|38
|-
|-
|align="center"|'
|align="center"|'
|align="center"|39
|align="center"|39
|align="center"|000 111
|align="center"|000 111
|align="center"|7
|&nbsp;
|&nbsp;
|align="center"|G
|align="center"|G
|align="center"|71
|align="center"|71
|align="center"|100 111
|align="center"|100 111
|align="center"|39
|-
|-
|align="center"|(
|align="center"|(
|align="center"|40
|align="center"|40
|align="center"|001 000
|align="center"|001 000
|align="center"|8
|&nbsp;
|&nbsp;
|align="center"|H
|align="center"|H
|align="center"|72
|align="center"|72
|align="center"|101 000
|align="center"|101 000
|align="center"|40
|-
|-
|align="center"|)
|align="center"|)
|align="center"|41
|align="center"|41
|align="center"|001 001
|align="center"|001 001
|align="center"|9
|&nbsp;
|&nbsp;
|align="center"|I
|align="center"|I
|align="center"|73
|align="center"|73
|align="center"|101 001
|align="center"|101 001
|align="center"|41
|-
|-
|align="center"|*
|align="center"|*
|align="center"|42
|align="center"|42
|align="center"|001 010
|align="center"|001 010
|align="center"|10
|&nbsp;
|&nbsp;
|align="center"|J
|align="center"|J
|align="center"|74
|align="center"|74
|align="center"|101 010
|align="center"|101 010
|align="center"|42
|-
|-
|align="center"|+
|align="center"|+
|align="center"|43
|align="center"|43
|align="center"|001 011
|align="center"|001 011
|align="center"|11
|&nbsp;
|&nbsp;
|align="center"|K
|align="center"|K
|align="center"|75
|align="center"|75
|align="center"|101 011
|align="center"|101 011
|align="center"|43
|-
|-
|align="center"|,
|align="center"|,
|align="center"|44
|align="center"|44
|align="center"|001 100
|align="center"|001 100
|align="center"|12
|&nbsp;
|&nbsp;
|align="center"|L
|align="center"|L
|align="center"|76
|align="center"|76
|align="center"|101 100
|align="center"|101 100
|align="center"|44
|-
|-
|align="center"|-
|align="center"|-
|align="center"|45
|align="center"|45
|align="center"|001 101
|align="center"|001 101
|align="center"|13
|&nbsp;
|&nbsp;
|align="center"|M
|align="center"|M
|align="center"|77
|align="center"|77
|align="center"|101 101
|align="center"|101 101
|align="center"|45
|-
|-
|align="center"|.
|align="center"|.
|align="center"|46
|align="center"|46
|align="center"|001 110
|align="center"|001 110
|align="center"|14
|&nbsp;
|&nbsp;
|align="center"|N
|align="center"|N
|align="center"|78
|align="center"|78
|align="center"|101 110
|align="center"|101 110
|align="center"|46
|-
|-
|align="center"|/
|align="center"|/
|align="center"|47
|align="center"|47
|align="center"|001 111
|align="center"|001 111
|align="center"|15
|&nbsp;
|&nbsp;
|align="center"|O
|align="center"|O
|align="center"|79
|align="center"|79
|align="center"|101 111
|align="center"|101 111
|align="center"|47
|-
|-
|align="center"|0
|align="center"|0
|align="center"|48
|align="center"|48
|align="center"|010 000
|align="center"|010 000
|align="center"|16
|&nbsp;
|&nbsp;
|align="center"|P
|align="center"|P
|align="center"|80
|align="center"|80
|align="center"|110 000
|align="center"|110 000
|align="center"|48
|-
|-
|align="center"|1
|align="center"|1
|align="center"|49
|align="center"|49
|align="center"|010 001
|align="center"|010 001
|align="center"|17
|&nbsp;
|&nbsp;
|align="center"|Q
|align="center"|Q
|align="center"|81
|align="center"|81
|align="center"|110 001
|align="center"|110 001
|align="center"|49
|-
|-
|align="center"|2
|align="center"|2
|align="center"|50
|align="center"|50
|align="center"|010 010
|align="center"|010 010
|align="center"|18
|&nbsp;
|&nbsp;
|align="center"|R
|align="center"|R
|align="center"|82
|align="center"|82
|align="center"|110 010
|align="center"|110 010
|align="center"|50
|-
|-
|align="center"|3
|align="center"|3
|align="center"|51
|align="center"|51
|align="center"|010 011
|align="center"|010 011
|align="center"|19
|&nbsp;
|&nbsp;
|align="center"|S
|align="center"|S
|align="center"|83
|align="center"|83
|align="center"|110 011
|align="center"|110 011
|align="center"|51
|-
|-
|align="center"|4
|align="center"|4
|align="center"|52
|align="center"|52
|align="center"|010 100
|align="center"|010 100
|align="center"|20
|&nbsp;
|&nbsp;
|align="center"|T
|align="center"|T
|align="center"|84
|align="center"|84
|align="center"|110 100
|align="center"|110 100
|align="center"|52
|-
|-
|align="center"|5
|align="center"|5
|align="center"|53
|align="center"|53
|align="center"|010 101
|align="center"|010 101
|align="center"|21
|&nbsp;
|&nbsp;
|align="center"|U
|align="center"|U
|align="center"|85
|align="center"|85
|align="center"|110 101
|align="center"|110 101
|align="center"|53
|-
|-
|align="center"|6
|align="center"|6
|align="center"|54
|align="center"|54
|align="center"|010 110
|align="center"|010 110
|align="center"|22
|&nbsp;
|&nbsp;
|align="center"|V
|align="center"|V
|align="center"|86
|align="center"|86
|align="center"|110 110
|align="center"|110 110
|align="center"|54
|-
|-
|align="center"|7
|align="center"|7
|align="center"|55
|align="center"|55
|align="center"|010 111
|align="center"|010 111
|align="center"|23
|&nbsp;
|&nbsp;
|align="center"|W
|align="center"|W
|align="center"|87
|align="center"|87
|align="center"|110 111
|align="center"|110 111
|align="center"|55
|-
|-
|align="center"|8
|align="center"|8
|align="center"|56
|align="center"|56
|align="center"|011 000
|align="center"|011 000
|align="center"|24
|&nbsp;
|&nbsp;
|align="center"|X
|align="center"|X
|align="center"|88
|align="center"|88
|align="center"|111 000
|align="center"|111 000
|align="center"|56
|-
|-
|align="center"|9
|align="center"|9
|align="center"|57
|align="center"|57
|align="center"|011 001
|align="center"|011 001
|align="center"|25
|&nbsp;
|&nbsp;
|align="center"|Y
|align="center"|Y
|align="center"|89
|align="center"|89
|align="center"|111 001
|align="center"|111 001
|align="center"|57
|-
|-
|align="center"|:
|align="center"|:
|align="center"|58
|align="center"|58
|align="center"|011 010
|align="center"|011 010
|align="center"|26
|&nbsp;
|&nbsp;
|align="center"|Z
|align="center"|Z
|align="center"|90
|align="center"|90
|align="center"|111 010
|align="center"|111 010
|align="center"|58
|-
|-
|align="center"|;
|align="center"|;
|align="center"|59
|align="center"|59
|align="center"|011 011
|align="center"|011 011
|align="center"|27
|&nbsp;
|&nbsp;
|align="center"|<nowiki>[</nowiki>
|align="center"|<nowiki>[</nowiki>
|align="center"|91
|align="center"|91
|align="center"|111 011
|align="center"|111 011
|align="center"|59
|-
|-
|align="center"|<
|align="center"|<
|align="center"|60
|align="center"|60
|align="center"|011 100
|align="center"|011 100
|align="center"|28
|&nbsp;
|&nbsp;
|align="center"|\
|align="center"|\
|align="center"|92
|align="center"|92
|align="center"|111 100
|align="center"|111 100
|align="center"|60
|-
|-
|align="center"|=
|align="center"|=
|align="center"|61
|align="center"|61
|align="center"|011 101
|align="center"|011 101
|align="center"|29
|&nbsp;
|&nbsp;
|align="center"|<nowiki>]</nowiki>
|align="center"|<nowiki>]</nowiki>
|align="center"|93
|align="center"|93
|align="center"|111 101
|align="center"|111 101
|align="center"|61
|-
|-
|align="center"|>
|align="center"|>
|align="center"|62
|align="center"|62
|align="center"|011 110
|align="center"|011 110
|align="center"|30
|&nbsp;
|&nbsp;
|align="center"|^
|align="center"|^
|align="center"|94
|align="center"|94
|align="center"|111 110
|align="center"|111 110
|align="center"|62
|-
|-
|align="center"|?
|align="center"|?
|align="center"|63
|align="center"|63
|align="center"|011 111
|align="center"|011 111
|align="center"|31
|&nbsp;
|&nbsp;
|align="center"|_
|align="center"|_
|align="center"|95
|align="center"|95
|align="center"|111 111
|align="center"|111 111
|align="center"|63
|-
|-
|
|
|
|
|
第375行: 第442行:
|align="center"|96
|align="center"|96
|align="center"|(1) 000 000
|align="center"|(1) 000 000
|align="center"|64
|}
|}



2006年7月30日 (日) 03:59的版本

uuencode這個名字是衍生自 "Unix-to-Unix encoding",原先是Unix系統下將二進位的資料藉由uucp郵件系統傳輸的一個編碼程式,是一種二進位到文字的編碼uudecode 是與uuencode搭配的解碼程式,uuencode/decode常見於電子郵件中的檔案傳送以及usenet新聞群組的貼文等等。近來以被MIME這種編碼程序大量取代.

編碼程序

Uuencode的編碼結果輸出檔案格式如下:

begin <輸入檔存取模式> <輸入檔名>
<編碼內容>
`
end

<輸入檔存取模式>

沿用自Unix系統檔案存取權限模式,由三個八進位的數字組成,其構成形式為:

擁有人 群組 其他人
讀取(r) 寫入(w) 執行(x) 讀取(r) 寫入(w) 執行(x) 讀取(r) 寫入(w) 執行(x)

舉例而言:當<輸入檔存取模式>666,轉換成二進位碼為110110110,也就是擁有人、群組以及其他人對於這個檔案都有讀取以及寫入的權力。

<編碼內容>

Uuencode repeatedly takes in a group of three bytes, adding trailing zeros if there are fewer than three bytes left. These 24 bits are split into four groups of six which are treated as numbers between 0 and 63. Decimal 32 is added to each number and they are output as ASCII characters which will lie in the range 32 (space) to 32+63 = 95 (underscore). ASCII characters greater than 95 may also be used; however, only the six right-most bits are relevant.

Each group of sixty output characters (corresponding to 45 input bytes) is output as a separate line preceded by an encoded character giving the number of encoded bytes on that line. For all lines except the last, this will be the character 'M' (ASCII code 77 = 32+45). If the input is not evenly divisible by 45, the last line will contain the remaining N output characters, preceded by the character whose code is 32 + the number of remaining input bytes. Finally, a line containing just a single space (or grave character) is output, followed by one line containing the string "end".

Sometimes each data line has extra dummy characters (often the grave accent) added to avoid problems with mailers that strip trailing spaces. These characters are ignored by uudecode. The grave accent (ASCII 96) can also be used in place of a space character. When stripped of their high bits they both decode to 100000.

Despite using this limited range of characters, there are still some problems encountered when uuencoded data passes through certain old computers. The worst offenders are computers using non-ASCII character sets such as EBCDIC. To solve this problem, the Xxencode format was created as a more robust version of the encoding, which used only alphanumeric characters and the plus and minus symbols.

uuencode編碼範例

簡短的例子

下面的表格顯示如何將Cat這三個ASCII字元編碼成uuencode的0V%T

原始字元 C a t
原始ASCII碼(十進位) 67 97 116
ASCII碼(二進位) 0 1 0 0 0 0 1 1 0 1 1 0 0 0 0 1 0 1 1 1 0 1 0 0
新的十進位數值 16 54 5 52
+32 48 86 37 84
編碼後的Uuencode字元 0 V % T

因此Cat這三個ASCII字元表示成uuencode的檔案形式:

begin 644 cat.txt
#0V%T
`
end

長範例

Uuencode對照表

下面的表格顯示uuencode所使用到的ASCII字元集、6-bit二進位碼以及十進位的對照。由上面Cat的例子可以看出其第一個編碼為十進位的16,對應下面表格uuencode十進位表示欄位,可以查出其uuencode的輸出碼為0

可列印的字元 十進位ASCII值 uuencode
二進位表示
uuencode
十進位表示
可列印的字元 十進位ASCII值 uuencode
二進位表示
uuencode
十進位表示
(space) 32 000 000 0   @ 64 100 000 32
! 33 000 001 1   A 65 100 001 33
" 34 000 010 2   B 66 100 010 34
# 35 000 011 3   C 67 100 011 35
$ 36 000 100 4   D 68 100 100 36
% 37 000 101 5   E 69 100 101 37
& 38 000 110 6   F 70 100 110 38
' 39 000 111 7   G 71 100 111 39
( 40 001 000 8   H 72 101 000 40
) 41 001 001 9   I 73 101 001 41
* 42 001 010 10   J 74 101 010 42
+ 43 001 011 11   K 75 101 011 43
, 44 001 100 12   L 76 101 100 44
- 45 001 101 13   M 77 101 101 45
. 46 001 110 14   N 78 101 110 46
/ 47 001 111 15   O 79 101 111 47
0 48 010 000 16   P 80 110 000 48
1 49 010 001 17   Q 81 110 001 49
2 50 010 010 18   R 82 110 010 50
3 51 010 011 19   S 83 110 011 51
4 52 010 100 20   T 84 110 100 52
5 53 010 101 21   U 85 110 101 53
6 54 010 110 22   V 86 110 110 54
7 55 010 111 23   W 87 110 111 55
8 56 011 000 24   X 88 111 000 56
9 57 011 001 25   Y 89 111 001 57
: 58 011 010 26   Z 90 111 010 58
; 59 011 011 27   [ 91 111 011 59
< 60 011 100 28   \ 92 111 100 60
= 61 011 101 29   ] 93 111 101 61
> 62 011 110 30   ^ 94 111 110 62
? 63 011 111 31   _ 95 111 111 63
  ` 96 (1) 000 000 64

參見

參考資料

本條目部分或全部内容出自以GFDL授權發佈的《自由線上電腦詞典》(FOLDOC)。

外部連結

  • UUDeview - open-source program to encode/decode Base64, BinHex, uuencode, xxencode, etc. for Unix/Windows/DOS