diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-03-31 08:57:28 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-04-05 00:42:01 -0400 |
commit | 0ade5ffe2778e7b238bba8d979ca4d53dee1e702 (patch) | |
tree | 462058f4b647ee6f31b4d9b19e6777ef85ff587e /src/shared/utf8.c | |
parent | a36b8debe67f3a5515200dada75cf4dbc334c7f5 (diff) |
journal: fix export of messages containing newlines
In "export" format, newlines are significant, and messages containing
newlines must be exported as "binary".
Diffstat (limited to 'src/shared/utf8.c')
-rw-r--r-- | src/shared/utf8.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/shared/utf8.c b/src/shared/utf8.c index 0b524d8a90..c559c13678 100644 --- a/src/shared/utf8.c +++ b/src/shared/utf8.c @@ -136,7 +136,7 @@ int utf8_encoded_to_unichar(const char *str) { return unichar; } -bool utf8_is_printable(const char* str, size_t length) { +bool utf8_is_printable_newline(const char* str, size_t length, bool newline) { const uint8_t *p; assert(str); @@ -145,7 +145,8 @@ bool utf8_is_printable(const char* str, size_t length) { int encoded_len = utf8_encoded_valid_unichar((const char *)p); int val = utf8_encoded_to_unichar((const char*)p); - if (encoded_len < 0 || val < 0 || is_unicode_control(val)) + if (encoded_len < 0 || val < 0 || is_unicode_control(val) || + (!newline && val == '\n')) return false; length -= encoded_len; |