klen / peewee_migrate

Simple migration engine for Peewee
MIT License
353 stars 86 forks source link

Specify utf-8 encoding when writing a file in router.py #231

Open Nixellion opened 9 months ago

Nixellion commented 9 months ago

Without specifying "utf-8" encoding when writing a file the script fails to write text to a file in many cases.

I can't say if it's specific to OS region\language or contents of the file, but this simple change fixes any such issues, tested locally.

Changes in this PR

Add encoding="utf-8" to the file open on write.

cc/ @klen

Nixellion commented 9 months ago

A note, same change required for the

def read(self, name):
        """Read migration from file."""

but it's missing from this PR. I can create another PR with that change if needed