Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeString ¶
DecodeString will decode the provided UTF-7 string into UTF-8.
Any valid UTF-7 string can be decoded, not just the ones returned by the EncodeString function. In particular, UTF-7 strings such as "a+-b" or "a+AD0.b" can be decoded even if the EncodeString function won't generate the corresponding strings that way.
Note that this function requires the string to contain only ASCII chars (as per UTF-7), otherwise an error will be returned. Illegal char sequences in the encoded parts of the string will also trigger errors.
func EncodeString ¶
EncodeString will encode the provided UTF-8 string into UTF-7 format
The encoding process will have the following peculiarities * Any char outside the "direct characters" will be encoded. This means that only "a-z", "A-Z", "0-9" and "'(),-.:?" chars will remain intact while the rest will be encoded. "Optional direct chars" (such as the space) will be encoded. * The "+" char will be encoded as any other character, so the result will be "+ACs-", not "+-" * Sequences of chars will be encoded as a single group. For example, "こんにちは" will be encoded as "+MFMwkzBrMGEwbw-" * All encoded sequences will be enclosed between "+" and "-"