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

check encoding before trying to convert, avoids py3 errors #186

Merged
merged 1 commit into from
Apr 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pyxform/xls2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,13 @@ def workbook_to_json(
" Question or group with no name.")
question_name = unicode(row[constants.NAME])
if not is_valid_xml_tag(question_name):
if isinstance(question_name, bytes):
question_name = question_name.encode('utf-8')
error_message = row_format_string % row_number
error_message += " Invalid question name [" + \
question_name.encode('utf-8') + "] "
question_name + "] "
error_message += "Names must begin with a letter, colon,"\
+ " or underscore. "
+ " or underscore."
error_message += "Subsequent characters can include numbers," \
+ " dashes, and periods."
raise PyXFormError(error_message)
Expand Down