Main Page | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

MUTF7 Class Reference

List of all members.

Detailed Description

MUTF7 provides static member functions that convert to and from the modified UTF-7 encoding of Unicode.

The UTF-7 encoding encodes Unicode code points into 7-bit code units. (To use the terminology loosely, UTF-7 encodes Unicode into ASCII characters.) The standard UTF-7 encoding is specified in RFC 2152. The IMAP4 specification specifies a modified UTF-7 encoding for mailbox names.

Normally, you do not need to use the MUTF7 class to encode or decode IMAP4 mailbox names. The member functions of Imap4Client that take mailbox names as arguments do the encoding and decoding for you. However, the library uses the MUTF7 class internally and allows you to use it if you wish.

To understand the naming of the member functions, you should understand the underlying model. In the underlying model, applications process text in the UTF-16 encoding. Therefore, UTF-16 text is considered decoded text. UTF-7 text is considered encoded text.

See also:
RFC 2152 UTF-7: A Mail-Safe Transformation Format of Unicode

Modified UTF-7 encoding in RFC 3501


Static Public Member Functions

size_t EncodeLen (const uint16_t *utf16, size_t utf16Len)
 Gets the length of the UTF-7 string that would result from encoding the UTF-16 string.
size_t Encode (const uint16_t *utf16, size_t utf16Len, char *utf7, size_t utf7MaxLen)
 Converts a UTF-16 string to UTF-7.
size_t DecodeLen (const char *utf7, size_t utf7Len)
 Gets the length of the UTF-16 string that would result from decoding the UTF-7 string.
size_t Decode (const char *utf7, size_t utf7Len, uint16_t *utf16, size_t utf16MaxLen)
 Converts a UTF-7 string to UTF-16.


Member Function Documentation

size_t Decode const char *  utf7,
size_t  utf7Len,
uint16_t *  utf16,
size_t  utf16MaxLen
[static]
 

Converts a UTF-7 string to UTF-16.

Parameters:
utf7 the UTF-7 text
utf7Len the number of bytes in the UTF-7 text
utf16 the output buffer for the UTF-16 text
utf16MaxLen the maximum number of (16-bit) characters to write to the output buffer
Returns:
the number of (16-bit) characters written to the output buffer (that is, the length of the UTF-16 string)

size_t DecodeLen const char *  utf7,
size_t  utf7Len
[static]
 

Gets the length of the UTF-16 string that would result from decoding the UTF-7 string.

You may use this function to determine the required length of the array you need for the UTF-16 string. The return value is the length of the UTF-16 string in (16-bit) characters.

Parameters:
utf7 the UTF-7 text
utf7Len the number of bytes in the UTF-7 text
Returns:
the length in (16-bit) characters of the UTF-16 text

size_t Encode const uint16_t *  utf16,
size_t  utf16Len,
char *  utf7,
size_t  utf7MaxLen
[static]
 

Converts a UTF-16 string to UTF-7.

Parameters:
utf16 the UTF-16 text
utf16Len the number of (16-bit) characters in the UTF-16 text
utf7 the output buffer for the UTF-7 text
utf7MaxLen the maximum number of bytes to write to the output buffer
Returns:
the number of bytes written to the output buffer (that is, the length of the UTF-7 string in bytes)

size_t EncodeLen const uint16_t *  utf16,
size_t  utf16Len
[static]
 

Gets the length of the UTF-7 string that would result from encoding the UTF-16 string.

You may use this function to determine the required length of the array you need for the UTF-7 string. The return value is the length of the UTF-7 string in bytes.

Parameters:
utf16 the UTF-16 text
utf16Len the number of (16-bit) characters in the UTF-16 text
Returns:
the length in bytes of the UTF-7 text

Copyright © 2001-2005 Hunny Software, Inc. All rights reserved.