From e7b198849d3a29449fc20fe1dc57f72250d90b35 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Tue, 10 Sep 2019 22:49:53 +0000 Subject: [PATCH] Copy comment for dc_encode_headers_words from C code --- src/dc_strencode.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/dc_strencode.rs b/src/dc_strencode.rs index e1f4d1526..2dc51cce4 100644 --- a/src/dc_strencode.rs +++ b/src/dc_strencode.rs @@ -12,6 +12,20 @@ use crate::dc_tools::*; use crate::types::*; use crate::x::*; +/** + * Encode non-ascii-strings as `=?UTF-8?Q?Bj=c3=b6rn_Petersen?=`. + * Belongs to RFC 2047: https://tools.ietf.org/html/rfc2047 + * + * We do not fold at position 72; this would result in empty words as `=?utf-8?Q??=` which are correct, + * but cannot be displayed by some mail programs (eg. Android Stock Mail). + * however, this is not needed, as long as _one_ word is not longer than 72 characters. + * _if_ it is, the display may get weird. This affects the subject only. + * the best solution wor all this would be if libetpan encodes the line as only libetpan knowns when a header line is full. + * + * @param to_encode Null-terminated UTF-8-string to encode. + * @return Returns the encoded string which must be free()'d when no longed needed. + * On errors, NULL is returned. + */ pub unsafe fn dc_encode_header_words(to_encode: *const libc::c_char) -> *mut libc::c_char { let mut ok_to_continue = true; let mut ret_str: *mut libc::c_char = ptr::null_mut();