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

[bug] CSV import: failure on importing UTF16 encoded CSV files fails with 500 internal server error #550

Open
nemesifier opened this issue Sep 13, 2024 · 0 comments · May be fixed by #568
Labels
bug Something isn't working

Comments

@nemesifier
Copy link
Member

Describe the bug
Only files encoded with UTF8 without BOM marker are accepted now, but trying to upload UTF16 fails with an exception that doesn't point out this issue.

Steps To Reproduce
Create batch import using CSV, try these select files:

Expected behavior
A clear error message or handling the encoding automatically.

Screenshots
Screenshot from 2024-09-13 19-23-27

@nemesifier nemesifier added the bug Something isn't working label Sep 13, 2024
akhilsharmaa added a commit to akhilsharmaa/openwisp-radius that referenced this issue Nov 22, 2024
The issue was that all CSV files were being read in UTF-8 format, causing failures when importing UTF-16 encoded files.

- Added support for detecting file encoding using the popular Python library chardet.
- If chardet fails to recognize the encoding, explicitly handle the files as UTF-16.
This change ensures proper handling of both UTF-8 and UTF-16 encoded CSV files.

Fixes openwisp#550
akhilsharmaa added a commit to akhilsharmaa/openwisp-radius that referenced this issue Nov 22, 2024
The issue was that all CSV files were being read in UTF-8 format, causing failures when importing UTF-16 encoded files.

- Added support for detecting file encoding using the popular Python library chardet.
- If chardet fails to recognize the encoding, explicitly handle the files as UTF-16.
This change ensures proper handling of both UTF-8 and UTF-16 encoded CSV files.

Fixes openwisp#550
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: To do (general)
Development

Successfully merging a pull request may close this issue.

1 participant