Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mailman not in UTF8 : ./scripts/mm2s_unpickle.py #1

Closed
kepon85 opened this issue Jan 16, 2022 · 0 comments
Closed

Mailman not in UTF8 : ./scripts/mm2s_unpickle.py #1

kepon85 opened this issue Jan 16, 2022 · 0 comments

Comments

@kepon85
Copy link
Contributor

kepon85 commented Jan 16, 2022

My mailman is not in UTF8

To get the ./scripts/mm2s_unpickle.py script to work and not get the error:

Traceback (most recent call last):
  File "./scripts/mm2s_unpickle.py", line 31, in <module>
    print(json.dumps(config_dict))
  File "/usr/lib/python2.7/json/__init__.py", line 244, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 127: invalid continuation byte

I modified this as follows:

import os
+import unicodedata

mm_path=os.getenv('MAILMAN_HOME', '/usr/share/mailman')

[...]

config_dict['bounce_info'] = str(config_dict.get('bounce_info'))
+for key in config_dict:
+    if type(config_dict[key]) == str:
+        config_dict[key] = unicodedata.normalize('NFKD',unicode(config_dict[key],"ISO-8859-1")).encode("ascii","ignore")
print(json.dumps(config_dict))
infile.close()

Thanks for your job!

@kepon85 kepon85 closed this as completed Jan 16, 2022
kepon85 added a commit to kepon85/mailman2sympa that referenced this issue Jan 16, 2022
A timestamp is expected in the Sympa database, except in the CSV I have a YYYY-MM-DD format. It is therefore necessary to convert them in the script so as not to have the error:

```
Finished with users - now handling their subscription
DBD::mysql::st execute failed: Data truncated for column 'date_epoch_subscriber' at row 1 at ./scripts/loadsubscribers.pl line 202.
Can't call method "finish" on an undefined value at
	./scripts/loadsubscribers.pl line 265 (LAKostis#1)
    (F) You used the syntax of a method call, but the slot filled by the
    object reference or package name contains an undefined value.  Something
    like this will reproduce the error:
    
        $BADREF = undef;
        process $BADREF 1,2,3;
        $BADREF->process(1,2,3);
    
Uncaught exception from user code:
	Can't call method "finish" on an undefined value at ./scripts/loadsubscribers.pl line 265.
```

Note : Debian 9, mailman and sympa in debian package version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant