Convert strings to/from utf7/utf8. More...
#include "config.h"
#include <stdbool.h>
#include <string.h>
#include "private.h"
#include "mutt/lib.h"
#include "core/lib.h"
Go to the source code of this file.
Functions | |
static char * | utf7_to_utf8 (const char *u7, size_t u7len, char **u8, size_t *u8len) |
Convert data from RFC2060's UTF-7 to UTF-8. | |
static char * | utf8_to_utf7 (const char *u8, size_t u8len, char **u7, size_t *u7len) |
Convert data from UTF-8 to RFC2060's UTF-7. | |
void | imap_utf_encode (bool unicode, char **s) |
Encode email from local charset to UTF-8. | |
void | imap_utf_decode (bool unicode, char **s) |
Decode email from UTF-8 to local charset. | |
Variables | |
static const int | Index64u [128] |
Lookup table for Base64 encoding/decoding. | |
static const char | B64Chars [64] |
Characters of the Base64 encoding. | |
Convert strings to/from utf7/utf8.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file utf7.c.
|
static |
Convert data from RFC2060's UTF-7 to UTF-8.
[in] | u7 | UTF-7 data |
[in] | u7len | Length of UTF-7 data |
[out] | u8 | Save the UTF-8 data pointer |
[out] | u8len | Save the UTF-8 data length |
ptr | UTF-8 data |
NULL | Error |
RFC2060 obviously intends the encoding to be unique (see point 5 in section 5.1.3), so we reject any non-canonical form, such as &ACY- (instead of &-) or &AMA-&AMA- (instead of &AMAAwA-).
Definition at line 106 of file utf7.c.
|
static |
Convert data from UTF-8 to RFC2060's UTF-7.
[in] | u8 | UTF-8 data |
[in] | u8len | Length of UTF-8 data |
[out] | u7 | Save the UTF-7 data pointer |
[out] | u7len | Save the UTF-7 data length |
ptr | UTF-7 data |
NULL | Error |
Unicode characters above U+FFFF converted to a UTF-16 surrogate pair.
Definition at line 252 of file utf7.c.
void imap_utf_encode | ( | bool | unicode, |
char ** | s | ||
) |
Encode email from local charset to UTF-8.
[in] | unicode | true if Unicode is allowed |
[out] | s | Email to convert |
Definition at line 397 of file utf7.c.
void imap_utf_decode | ( | bool | unicode, |
char ** | s | ||
) |
Decode email from UTF-8 to local charset.
[in] | unicode | true if Unicode is allowed |
[out] | s | Email to convert |
Definition at line 430 of file utf7.c.
|
static |
Lookup table for Base64 encoding/decoding.
This is very similar to the table in lib/lib_base64.c Encoding chars: utf7 A-Za-z0-9+, mime A-Za-z0-9+/
|
static |
Characters of the Base64 encoding.