Core Function UUEncode

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> UUEncode( <expression> ) </pre> === Description === Encodes a string using the uuencode algorithm. Uuencode translates all strings (including binary's ones) into printa...")
 
Line 1: Line 1:
 
<pre>
 
<pre>
UUEncode( <expression> )
+
UUEncode( <expression> )
 
</pre>
 
</pre>
  

Revision as of 18:14, 27 September 2013

UUEncode( <expression> )

Contents

Description

Encodes a string using the uuencode algorithm.

Uuencode translates all strings (including binary's ones) into printable characters, making them safe for network transmissions.

Uuencoded data is about 35% larger than the original.

Parameters

expression

The data to be encoded.

Can be a string or binary variable.

If it is neither of the above it will be converted into a string and used anyway.

Return Value

Success: Returns the uuencoded data

Failure: Returns empty string.

Remarks

This function produces results that are equal to PHPs.

If you require results equal to Perl try the UUEncode found on the Pack( ) function.

Example

echo UUEncode("Testy");
# Prints: 
# %5&5S='D`
# `

Perl compatible UUEncode a string

echo PerlUUEncode("Testy");
# Prints: %5&5S='D`
 
Function PerlUUEncode ( $str )
{
	return (string)pack("u", $str);
}
 
# Notice this Perl compatible one produces a slightly
# different text to the one above? Of course both are
# valid and Unpack() will read both the Perl/PHP styles
# with no problem
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox