forked from haskell/cabal
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make UTF-8 decoding errors in .cabal files non-fatal
Previously we checked for invalid UTF-8 in the first phase of the parser, which splitting the file up into nested sections and fields. This meant the whole parser falls over if there is invalid UTF-8 anywhere in the file. Sadly there are already packages on hackage with invalid UTF-8 so we would fail when parsing the hackage index. The solution is to move the check into the parsing of the individual fields and making it a warning not an error. We most typically get invalid UTF-8 in free text fields like author name, copyright, description etc so this should work out ok usually. We now get pretty decent error messages, like: Warning: hsx.cabal:5: Invalid UTF-8 text in the 'author' field. The warning type is now structured so that hackage will be able to distinguish general non-fatal warnings from UTF-8 decoding problems which really should be fatal errors for package uploads.
- Loading branch information
Showing
2 changed files
with
27 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters