Tools, FAQ, Tutorials:
Applying UUEncode to a String in PHP
How To Apply UUEncode to a String?
✍: FYIcenter.com
UUEncode (Unix-to-Unix Encoding) is a simple algorithm to convert a string of any characters into a string of printable characters. UUEncode is reversible. The reverse algorithm is called UUDecode. PHP offers two functions for you to UUEncode or UUDecode a string: convert_uuencode() and convert_uudecode(), Here is a PHP script on how to use them:
<?php
$msgRaw = "
From\tTo\tSubject
Joe\tLee\tHello
Dan\tKia\tGreeting";
$msgEncoded = convert_uuencode($msgRaw);
$msgDecoded = convert_uudecode($msgEncoded);
if ($msgRaw === $msgDecoded) {
  print("Conversion OK\n");
  print("UUEncoded message:\n");
  print("-->$msgEncoded<--\n");
  print("UUDecoded message:\n");
  print("-->$msgDecoded<--\n");
} else {
  print("Conversion not OK:\n");
}
?>
This script will print:
Conversion OK UUEncoded message: -->M1G)O;0E4;PE3=6)J96-T#0I*;V4)3&5E"4AE;&QO#0I$86X)2VEA"4=R965T #:6YG ` <-- UUDecoded message: --> From To Subject Joe Lee Hello Dan Kia Greeting<--
The output shows you that the UUEncode string is a multiple-line string with a special end-of-string mark \x20.
⇒ Replacing Characters in a String in PHP
⇐ Joining Multiple Strings in PHP
2016-10-13, ∼2021🔥, 0💬
Popular Posts:
How to add an API to an API product for internal testing on the Publisher Portal of an Azure API Man...
Where can I download the EPUB 2.0 sample book "The Metamorphosis" by Franz Kafka? You can following ...
How to access URL template parameters from "context.Request.Matched Parameters"object in Azure API P...
How to create a new API on the Publisher Dashboard of an Azure API Management Service? If you are ne...
How To Pad an Array with the Same Value Multiple Times in PHP? If you want to add the same value mul...