Difference between revisions of "$decode"

From Scriptwiki
Jump to: navigation, search
 
m
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

Revision as of 17:38, 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 characters in the given chunk, or $null if N is too large