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

ICS export doesn't work for speakers with non latin1 letters #841

sparunakian opened this issue Dec 16, 2019 · 2 comments

ICS export doesn't work for speakers with non latin1 letters #841

sparunakian opened this issue Dec 16, 2019 · 2 comments


Copy link

@sparunakian sparunakian commented Dec 16, 2019


Current Behavior

When using the ICS export on a speaker page on the schedule, if the speaker has non latin1 letters in his name, pretalx will return Internal Server Error.

Expected Behavior

The ICS export should be generated and downloadable.

Steps to Reproduce

  1. Go to a public speaker page, of a speaker with non latin1 letters.
  2. Try to download the ical.


I think that the issue comes from this line:

] = f'attachment; filename="{request.event.slug}-{speaker_name}.ics"'

It defines a HTTP header containing the speaker name, which can contain non latin1 letters.

I encountered the issue with Gunicorn 19.9.0, which was more restrictive and required ASCII-only letters. I had issues with the following speaker:

[2019-12-16 19:28:09 +0000] [8407] [ERROR] Error handling request /jdll2019/speaker/PE93CF/talks.ics
Traceback (most recent call last):
  File "/var/pretalx/.local/lib/python3.6/site-packages/gunicorn/workers/", line 135, in handle
    self.handle_request(listener, req, client, addr)
  File "/var/pretalx/.local/lib/python3.6/site-packages/gunicorn/workers/", line 182, in handle_request
  File "/var/pretalx/.local/lib/python3.6/site-packages/gunicorn/http/", line 333, in write
  File "/var/pretalx/.local/lib/python3.6/site-packages/gunicorn/http/", line 329, in send_headers
    util.write(self.sock, util.to_bytestring(header_str, "ascii"))
  File "/var/pretalx/.local/lib/python3.6/site-packages/gunicorn/", line 507, in to_bytestring
    return value.encode(encoding)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 180: ordinal not in range(128)

This has been changed in this commit: benoitc/gunicorn@879651b. Now Gunicorn require latin1-only letters, which is less restrictive. With Gunicorn 20.0.4, I cannot reproduce the error as we don't have speakers with non-latin1 letters.

It seems that this instance uses an older version of Gunicorn, which requires ASCII-only letters:

This issue is less problematic when using Latin alphabet with a recent Gunicorn version, but can still be inconvenient for non Latin letters.

One solution could be replacing the speaker name by the speaker code in the filename.

Your Environment

  • Version used: 1.0.4
  • Environment name and version (e.g. Chrome 39, python 3.5): Python 3.6.9
  • Operating System and version (desktop or mobile): Ubuntu 18.04.3
  • Link to your instance, if in production:
Copy link

@rixx rixx commented Dec 16, 2019

This is not exactly a pretalx issue, since gunicorn is not a dependency and there are other WSGI servers out there, but I guess we should do the best we can in this case.

Copy link
Contributor Author

@sparunakian sparunakian commented Dec 16, 2019

Thank you!

rixx added a commit that referenced this issue Dec 16, 2019
Older gunicorn versions are sensitive to non-ASCII filenames in
attachment headers. We're using reasonable amounts of effort to convert
composed letters to their ascii main parts, or just drop them silently.
Closes #841
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants