• Davide Caroselli's avatar
    Enforce UTF-8 when open() text files (#460) · 38f1dee9
    Davide Caroselli authored
    Summary:
    When opening text files without specifying the encoding (i.e. `open(path, "r")` or `open(path, "w")`), python3 will use the preferred locale encoding (`locale.getpreferredencoding()`) so the result is platform dependent and can change from one machine to another.
    
    I believe fairseq should enforce its standard (UTF-8 seems like the best choice to me). This pull request explicity specify UTF-8 encoding when reading text files.
    Pull Request resolved: https://github.com/pytorch/fairseq/pull/460
    
    Differential Revision: D13802525
    
    Pulled By: myleott
    
    fbshipit-source-id: 672fd55707ee559ab36d74bc1c24026166ea2367
    38f1dee9
preprocess.py 13.2 KB