1 (edited by Maxim 2018-07-09 22:09:24)

Topic: utf8mb4 decode error in iRedApd

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version: 0.9.8
- Linux/BSD distribution name and version: Debian Wheezy
- Store mail accounts in which backend: MySQL
- Web server:  Nginx
- Manage mail accounts with iRedAdmin-Pro? No
====

I'm using MySQL databases default collation as utf8mb4.

When i've trying to execute this command:
python wblist_admin.py --list --whitelist

I've get this error:
* Establishing SQL connection.
* List all inbound whitelist for account: @.
unknown encoding: utf8mb4

Changing 'amavisd' database default collation to utf8mb4 and table 'wblist' is not give success results.

I've found via Stack Overflow that issue is related with ut8mb4 encoding in Python.
But I'm not expert with Python.

So my question is should I change something on my server/scripts, or this is an iRedApd's issue only and will be fix in next release?

Thanks for great support

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: utf8mb4 decode error in iRedApd

iRedAPD is written in Python, it uses module "MySQL-Python" for SQL connection. i think MySQL-python has problem with this encode.

3

Re: utf8mb4 decode error in iRedApd

Ok.

Can you enforce UTF-8 in iRedAPD in next release because I'm not a python coder?

I've tried something from this solution https://stackoverflow.com/questions/265 … -in-python on my dev.server but without success results.

Or can you give me any advice how to fix this issue? Because I'm worry about security and spamming on my websites.

Thanks a lot.

4

Re: utf8mb4 decode error in iRedApd

Could you try this patch for iRedAPD-2.2? It asks SQLalchemy to connect to SQL db as utf8 charset.

diff -r 54f20cfec66e libs/utils.py
--- a/libs/utils.py    Wed Jul 25 19:28:26 2018 +0200
+++ b/libs/utils.py    Sun Jul 29 22:53:05 2018 +0200
@@ -266,6 +266,8 @@
                                        int(settings.__dict__[db + '_db_port']),
                                        settings.__dict__[db + '_db_name'])

+        uri += '?charset=utf8'
+
         conn = create_engine(uri,
                              pool_size=settings.SQL_CONNECTION_POOL_SIZE,
                              pool_recycle=settings.SQL_CONNECTION_POOL_RECYCLE,

5 (edited by Maxim 2018-07-31 01:34:37)

Re: utf8mb4 decode error in iRedApd

Awesome! It's work!
Thank you!