Skip to content

PDA display function crashes when rendering Unicode rightarrow #6

@jdaymude

Description

@jdaymude

Many students reported the PDA::display_state_diagram function crashing with the error:

UnicodeEncodeError: 'charmap' codec can't encode character '\u2192' in position xxx: character maps to <undefined>

For context, the function is trying to write PDA transition labels of the form "a, b → c", where the → character is \u2192. Of course, the charmap coding doesn't understand unicode, which is causing the failure. We need utf-8 encoding instead. As a short term fix, students were able to successfully get around this by launching their interactive Python session with:

python -X utf8

What's a bit of a mystery to me is why this works for some students out of the box and not for others (I would expect consistent failures), but this might be related to our broader issue of not controlling an installation environment for the package. It's probably python version dependent or something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions