Skip to content

Wiki StrEncode

Danijel Galić edited this page Jan 23, 2024 · 1 revision
final class \FireHub\Core\Support\LowLevel\StrEncode()

Important

This class is marked as final.

### String encoding low-level proxy class

Encoding is the process of assigning numbers to graphical characters, especially the written characters of human language, allowing them to be stored, transmitted, and transformed using digital computers.

This class was created by Danijel Galić <danijel.galic@outlook.com>
Copyright: 2024 FireHub Web Application Framework
License: <https://opensource.org/licenses/OSL-3.0> OSL Open Source License version 3
Version: GIT: $Id$ Blob checksum.

Fully Qualified Class Name:  \FireHub\Core\Support\LowLevel\StrEncode
Source code:  view source code
Blame:  view blame
History:  view history

Methods

Type Name Title
public static base64Encode ### Encodes string with MIME base64
public static base64Decode ### Decodes data encoded with MIME base64
public static uuEncode ### Uuencode a string
public static uuDecode ### Decode an uuencoded data
public static quotedPrintableEncode ### Convert a 8bit string to a quoted-printable data
public static quotedPrintableDecode ### Convert a quoted-printable data to an 8 bit string
public static StrEncode::base64Encode(string $string):string

### Encodes string with MIME base64

This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies. Base64-encoded data takes about 33% more space than the original data.

Source code:  view source code
Blame:  view blame

Parameters

  • string $string - The data to be encoded.

Returns

  • string - Base64 encoded data.
public static StrEncode::base64Decode(string $data):string

### Decodes data encoded with MIME base64

Source code:  view source code
Blame:  view blame

Parameters

  • string $data - The base64 encoded data.

Throws

  • \Error - If we cannot decode $data to base64.

Returns

  • string - Decoded string.
public static StrEncode::uuEncode(string $string):string

Note

UUEncode neither produces the beginning nor the end line, which are part of uuencoded files.

### Uuencode a string

Encodes a string using the uuencode algorithm. Uuencode translates all strings (including binary data) into printable characters, making them safe for network transmissions. Uuencoded data is about 35% larger than the original.

Source code:  view source code
Blame:  view blame

Parameters

  • string $string - The data to be encoded.

Returns

  • string - The uuencoded data.
public static StrEncode::uuDecode(string $data):string

Note

UUDecode neither accepts the beginning nor the end line, which are part of uuencoded files.

### Decode an uuencoded data

Source code:  view source code
Blame:  view blame

Parameters

  • string $data - The uuencoded data.

Throws

  • \Error - If we cannot uudecode $data.

Returns

  • string - Decoded data as a string.
public static StrEncode::quotedPrintableEncode(string $string):string

Note

This method is a useful tool for working with email messages.

### Convert a 8bit string to a quoted-printable data

Source code:  view source code
Blame:  view blame

Parameters

  • string $string - The data to be encoded.

Returns

  • string - Quoted-printable encoded data.
public static StrEncode::quotedPrintableDecode(string $data):string

Note

This method is a useful tool for working with email messages.

### Convert a quoted-printable data to an 8 bit string

Source code:  view source code
Blame:  view blame

Parameters

  • string $data - The quoted printable data.

Returns

  • string - The 8-bit binary string.
Clone this wiki locally