Skip to content

Error for non-UTF inputs #10

@giovannipizzi

Description

@giovannipizzi

Here this is done outside the try/except:

filecontent = structurefile.read().decode("utf-8")

And therefore it crashes for non-UTF8 inputs, e.g. this CIF:
NiTe2.txt

The simplest approach is to put that line inside the next try block, at least to show a nice error message rather than a 500 error.
The second step would be to see if one can avoid decoding using directly bytes, or try some clever detection of encoding since often the weird characters are not really needed and can be ignored.

Originally reported in materialscloud-org/issues#22

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions