Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Commit

Permalink
ignore BOM byte from Excel
Browse files Browse the repository at this point in the history
  • Loading branch information
runestonetest committed Jun 16, 2020
1 parent 49dbc80 commit 69ad237
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2400,7 +2400,9 @@ def enroll_students():
return redirect(URL("admin", "admin"))
students = request.vars.students
try:
strfile = io.TextIOWrapper(students.file, encoding="UTF8")
# use utf-8-sig because it will work with files from excel that have
# the byte order marker BOM set as an invisible first character in the file
strfile = io.TextIOWrapper(students.file, encoding="utf-8-sig")
student_reader = csv.reader(strfile)
except Exception as e:
session.flash = "please choose a CSV file with student data"
Expand Down

0 comments on commit 69ad237

Please sign in to comment.