Difference between revisions of "$decode"
From Scriptwiki
m (Category and rewording of return) |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
Decodes text from a [[Variables|variable]] or a binary variable that was encoded using Mime or Uuencode. | Decodes text from a [[Variables|variable]] or a binary variable that was encoded using Mime or Uuencode. | ||
− | $decode(%var | &binvar, mubt, N) | + | $decode(%var | &binvar[, mubt][, N]) |
− | * The first parameter is the [[Variables|variable]] or [[Binary Files|binary variable]] containing the encoded text | + | * The first parameter is the [[Variables|variable]], raw text or [[Binary Files|binary variable]] containing the encoded text |
* The second parameter is a list of options pertaining to the type of encoding, and the type of variable given. Defaults are ut. | * The second parameter is a list of options pertaining to the type of encoding, and the type of variable given. Defaults are ut. | ||
** m means that the text is encoded using Mime. Do not use with u. | ** m means that the text is encoded using Mime. Do not use with u. | ||
Line 9: | Line 9: | ||
** b means that the text is in a binary variable. Do not use with t. | ** b means that the text is in a binary variable. Do not use with t. | ||
** t means that the text is given straight or in a [[Variables|variable]]. Do not use with b. | ** t means that the text is given straight or in a [[Variables|variable]]. Do not use with b. | ||
− | * The last parameter is which chunk of encoded text you wish to return. Decode will decode the information into 60-character-each chunks. 0 returns the total number of chunks. | + | * The last parameter is which chunk of encoded text you wish to return. Decode will decode the information into 60-character-each chunks. 0 returns the total number of chunks. Default is 1. |
* Returns | * Returns | ||
Line 15: | Line 15: | ||
** For text or [[Variables|variables]] | ** For text or [[Variables|variables]] | ||
*** For N=0, returns the total number of 60-character chunks exists. | *** For N=0, returns the total number of 60-character chunks exists. | ||
− | *** For N>0, returns the | + | *** For N>0, returns the encoded result in the given chunk, or $null if N is too large. |
+ | |||
+ | [[Category:Text and Number Identifiers]] |
Latest revision as of 17:45, 10 May 2008
Decodes text from a variable or a binary variable that was encoded using Mime or Uuencode.
$decode(%var | &binvar[, mubt][, N])
- The first parameter is the variable, raw text or binary variable containing the encoded text
- The second parameter is a list of options pertaining to the type of encoding, and the type of variable given. Defaults are ut.
- m means that the text is encoded using Mime. Do not use with u.
- u means that the text is encoded using Uuencode. Do not use with m
- b means that the text is in a binary variable. Do not use with t.
- t means that the text is given straight or in a variable. Do not use with b.
- The last parameter is which chunk of encoded text you wish to return. Decode will decode the information into 60-character-each chunks. 0 returns the total number of chunks. Default is 1.
- Returns
- For binary variables, returns the number of bytes written to the binary file.
- For text or variables
- For N=0, returns the total number of 60-character chunks exists.
- For N>0, returns the encoded result in the given chunk, or $null if N is too large.