aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_encoding.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-19 16:49:46 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-19 16:49:46 +0000
commit41f091a7b2aaae65272306ee5c356a39622563f5 (patch)
tree1c88900814561871abcbfa3244bbc318ee6d877c /src/libmime/mime_encoding.h
parent60fdd0ae9bcca8e10a1e99dee3d0441ef4d1df19 (diff)
downloadrspamd-41f091a7b2aaae65272306ee5c356a39622563f5.tar.gz
rspamd-41f091a7b2aaae65272306ee5c356a39622563f5.zip
[Minor] Add routine to recode byte arrays to utf-8
Diffstat (limited to 'src/libmime/mime_encoding.h')
-rw-r--r--src/libmime/mime_encoding.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libmime/mime_encoding.h b/src/libmime/mime_encoding.h
index 9c0975406..eb3a59942 100644
--- a/src/libmime/mime_encoding.h
+++ b/src/libmime/mime_encoding.h
@@ -50,6 +50,16 @@ gchar * rspamd_mime_text_to_utf8 (rspamd_mempool_t *pool,
gsize *olen, GError **err);
/**
+ * Converts data from `in` to `out`, returns `FALSE` if `enc` is not a valid iconv charset
+ * @param in
+ * @param out
+ * @param enc
+ * @return
+ */
+gboolean rspamd_mime_to_utf8_byte_array (GByteArray *in,
+ GByteArray *out, const gchar *enc);
+
+/**
* Maybe convert part to utf-8
* @param task
* @param text_part
@@ -58,5 +68,14 @@ gchar * rspamd_mime_text_to_utf8 (rspamd_mempool_t *pool,
GByteArray * rspamd_mime_text_part_maybe_convert (struct rspamd_task *task,
struct rspamd_mime_text_part *text_part);
+/**
+ * Checks utf8 charset and normalize/validate utf8 string
+ * @param charset
+ * @param in
+ * @param len
+ * @return
+ */
+gboolean rspamd_mime_charset_utf_check (rspamd_ftok_t *charset,
+ gchar *in, gsize len);
#endif /* SRC_LIBMIME_MIME_ENCODING_H_ */