Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

ff -c is not fixing C++ files that lacks UTF-8 BOM (it's only checking and giving errors) #37

Open
tadeu opened this issue Dec 14, 2018 · 1 comment

Comments

@tadeu
Copy link
Member

tadeu commented Dec 14, 2018

ff should check (ok), but ff -c should fix the files (add the BOM marker).

This is related to issue #31.

@tadeu
Copy link
Member Author

tadeu commented Feb 22, 2019

There's another new problem with BOM's whose fix could probably be bundled together:

Traceback (most recent call last):                                                                       
  File "C:\env\Scripts\ff-script.py", line 9, in <module>                                 
    sys.exit(main())                                                                                     
  File "C:\env\lib\site-packages\click\core.py", line 764, in __call__                    
    return self.main(*args, **kwargs)                                                                    
  File "C:\env\lib\site-packages\click\core.py", line 717, in main                        
    rv = self.invoke(ctx)                                                                                
  File "C:\env\lib\site-packages\click\core.py", line 956, in invoke                      
    return ctx.invoke(self.callback, **ctx.params)                                                       
  File "C:\env\lib\site-packages\click\core.py", line 555, in invoke                      
    return callback(*args, **kwargs)                                                                     
  File "C:\env\lib\site-packages\esss_fix_format\cli.py", line 153, in main               
    return _main(files_or_directories, check, stdin, commit, format_code)                                
  File "C:\env\lib\site-packages\esss_fix_format\cli.py", line 311, in _main              
    changed, new_errors, formatter = _process_file(filename, check, format_code)                         
  File "C:\env\lib\site-packages\esss_fix_format\cli.py", line 174, in _process_file      
    fmt, reason = should_format(filename)                                                                
  File "C:\env\lib\site-packages\esss_fix_format\cli.py", line 49, in should_format       
    if 'jupytext' not in f.read():                                                                       
  File "C:\env\lib\encodings\cp1252.py", line 23, in decode                               
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]                                    
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 945: character maps to <undefined>

seems related to a missing encoding in f.read() in that jupytext recent feature

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant