Michael Monnerie wrote:
> On Mittwoch, 9. April 2008 Michael Monnerie wrote:
>> Error:[sql] dbpgsql.c,db_query(+287): query failed [INSERT INTO
>> dbmail_headervalue (headername_id, physmessage_id, headervalue)
>> VALUES (9,1194586,'Schlumpf hat dich als FreundIn auf Facebook
>> hinzugef303 274gt...')] :[FEHLER: ungültige Byte-Sequenz für
>> Kodierung »UTF8«: 0xc320 HINT: Dieser Fehler kann auch auftreten,
>> wenn die Bytesequenz nicht mit der Kodierung übereinstimmt, die der
>> Server erwartet, welche durch »client_encoding« bestimmt wird. ]
>>
>> On Apr 8, I got this log entry in dbmail. How can it be that still
>> there are UTF8 errors? My DB is UTF8, client_encoding also. How could
>> I prevent this?
>
> I hope the discussion of lost cache entries doesn't make this issue
> lost. How could I prevent such problems? It looks like here I'm really
> loosing e-mail, as the headervalue has incorrect coding. Probably the
> e-mail itself can't be inserted too?
Email insertion is *not* charset dependent. Mail blobs are stored as-is and do
not require the charset voodoo that the header caching does require.
Please test the attached patch.
--
________________________________________________________________
Paul Stevens paul at nfg.nl
NET FACILITIES GROUP GPG/PGP: 1024D/11F8CD31
The Netherlands________________________________http://www.nfg.nl
diff --git a/dbmail-message.c b/dbmail-message.c
index d8b91cb..063b431 100644
--- a/dbmail-message.c
+++ b/dbmail-message.c
@@ -1017,16 +1017,16 @@ static gboolean _header_cache(const char UNUSED *key, const char *header, gpoint
for (i=0; i<values->len;i++) {
raw = (unsigned char *)g_tuples_index(values,i,1);
- char *value = NULL;
+ char *value = NULL, *rvalue = NULL;
const char *charset = dbmail_message_get_charset(self);
value = dbmail_iconv_decode_field((const char *)raw, charset, isaddr);
- if (! value)
- continue;
+ if (! value) continue;
- safe_value = dm_stresc(value);
- g_free(value);
+ rvalue = dbmail_iconv_str_to_db(value, charset); g_free(value);
+
+ safe_value = dm_stresc(rvalue); g_free(rvalue);
g_string_printf(q,"INSERT INTO %sheadervalue (headername_id, physmessage_id, headervalue) "
"VALUES (%llu,%llu,'%s')", DBPFX, id, self->physid, safe_value);
_______________________________________________
DBmail mailing list
[email protected]
https://mailman.fastxs.nl/mailman/listinfo/dbmail