robmcmullen / peppy

NO LONGER MAINTAINED
http://peppy.flipturn.org/
GNU General Public License v2.0
14 stars 7 forks source link

file load failed on fundamental mode when encoding not ascii and not marked #865

Closed robmcmullen closed 12 years ago

robmcmullen commented 12 years ago

[Trac time 20100909 233938Z] Sample file with non-ascii characters (see attached) fails to open with:

Traceback (most recent call last):
  File "/data2/home/rob/src/peppy/peppy/fileopener.py", line 176, in determineMajorMode
    self.scanBufferForMajorMode()
  File "/data2/home/rob/src/peppy/peppy/fileopener.py", line 199, in scanBufferForMajorMode
    self.modecls = MajorModeMatcherDriver.match(self.buffer, url=self.url)
  File "/data2/home/rob/src/peppy/peppy/majormodematcher.py", line 192, in match
    mode = cls.matchFile(buffer, magic_size, url, header)
  File "/data2/home/rob/src/peppy/peppy/majormodematcher.py", line 273, in matchFile
    likely = cls.scanLanguage(header, modes)
  File "/data2/home/rob/src/peppy/peppy/majormodematcher.py", line 532, in scanLanguage
    how_likely = mode.verifyLanguage(header)
  File "/data2/home/rob/src/peppy/peppy/fundamental.py", line 237, in verifyLanguage
    if line.startswith(cls.start_line_comment):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 97: ordinal not in range(128)

but if the filename is renamed .txt instead of .dot, it works.

robmcmullen commented 12 years ago

[Trac time 20100918 001836Z] 36159844e43f31aa2aa9014fac62a7f75659ca0a Refs #865: sample file added to repository

robmcmullen commented 12 years ago

[Trac time 20101110 180909Z] 1fd5aa025ae2019565106b9f2416cc7b0e8f1529 Fixed #865: added error print when scanLanguage fails