RobertoMachorro / Moped

A general purpose text editor, small and light.
https://roberto.machorro.net/Moped/
GNU General Public License v3.0
90 stars 8 forks source link

UNRECOGNIZED FILE #9

Closed rekatab closed 4 years ago

rekatab commented 4 years ago

When opening an .txt-File, which can be edited with unix command vi, moped often opens the file and displaying "UNRECOGNIZED FILE" instead of displaying the file contents in plaintext.

RobertoMachorro commented 4 years ago

Thanks for the feedback! Do you know if the file encoding is anything other than Unicode? Would it be possible for you to share one such file for testing/reproducing the issue?

rekatab commented 4 years ago

I think, the problem is with some representations of german umlauts... test2.txt test3.txt

RobertoMachorro commented 4 years ago

I think, the problem is with some representations of german umlauts... test2.txt test3.txt

Thanks for sending. BBEdit is reporting their format to be in Western (Mac OS Roman) / Windows (CRLF) - both files. VIM does an on the fly conversion for me. You are probably correct in that the Umlauts are causing this. That said, they should load. I'll work on this, because Moped should still be able to load them (recognizes them as public.plain-text). Will keep you posted.

image
RobertoMachorro commented 4 years ago

Got a new build out for testing. It tries to do encoding detection in known macOS formats. It's not complete, but gives good mileage. Download here.

image
RobertoMachorro commented 4 years ago

Research on the "right way" to detect encoding points to NSString.stringEncoding, however the API isn't returning accurate results. Going to go ahead and proceed with the trial/error method until this API gets fixed by Apple.

RobertoMachorro commented 4 years ago

This was raised up to Apple Support, the short story is: there is no sure way to identify documents. When in doubt, ask the user, and that is exactly what BBEdit does when it doesn't recognize the encoding of a file.

For now the automated recognition seems to work, as of v1.6 of Moped. Closing issue.