moremoban/moban

Non-textual source files should default to copy

jayvdb opened this issue · 4 comments

If a source file can not be read as a text file, it can not be a template, and thus should default to be a copy rule.

c.f. #322 , the other case where defaulting to copy action is helpful.

chfw commented

Makes sense. Maybe a default list for files that can be treated as binary?

I think try to open each 'template' as text with appropriate encoding, and if that fails then process it is binary.

If that was wrong, the output tells the user what happened and they can try to find why it is treated as binary.

chfw commented

I think you refer to the following exception.

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

It needs a bit thinking how to deal with aftermath.

chfw commented

I am deaf all the time. and every time, the time proves you are right.