BurntSushi / erd

Translates a plain text description of a relational database schema to a graphical entity-relationship diagram.
The Unlicense
1.79k stars 154 forks source link

fix encoding issue (#99) #102

Closed kukimik closed 3 years ago

kukimik commented 3 years ago

I hope this will close #99.

One alternative would be to assume that the input is always UTF-8 encoded, regardless of the locale.

Another idea would be to try UTF-8, and if it fails, then try the locale encoding. However, I'm not sure how to handle this properly.

@mmzx Please let me know what you think.

Before this gets merged we should perhaps include the information on the expected encoding somewhere in the README, maybe in the The er file format section. However, I wanted to know your opinion before trying to formulate this in a comprehensible way.

kukimik commented 3 years ago

I force-pushed a change that uses bracket_ to revert the encoding to the initial setting when we are done. This is a bit longer than the initial version in https://github.com/BurntSushi/erd/commit/1ff46710dcb7b80a50d5d214fd9ccc2888d7a789, but I believe it's better to clean up after ourselves, just in case one day this code gets used as a part of something larger.

mmzx commented 3 years ago

@kukimik Brilliant! It nicely fixes the issue, thank you very much in the name of all!