freelawproject / reporters-db

A database of court reporters, tests and other experiments
BSD 2-Clause "Simplified" License
93 stars 34 forks source link

Specify encoding to ensure cross-platform support when opening file #115

Closed quevon24 closed 2 years ago

quevon24 commented 2 years ago

If you work on Windows like me you will probably run into the same problem as me. I'm working with files with Unicode characters, when you use the python open() function to open a file without specifying explicitly the encoding it will be platform dependent, in the case of Windows the function will return cp1252 encoding instead of utf-8. You can read more about it right here: https://docs.python.org/3/library/functions.html#open

This change specifies encoding to utf-8 to ensure cross-platform compatibility when opening files in text mode. In this case when loading the json files for reporters, state abbreviations, case name abbreviations, etc.

mlissner commented 2 years ago

Yep! LGTM!