$decode

From Scriptwiki
Revision as of 17:38, 10 May 2008 by Aca20031 (talk | contribs)

Jump to: navigation, search

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