[Geany-devel] Binary files - a hangup fix and some more

Enrico Tröger enrico.troeger at xxxxx
Sat Feb 6 16:06:10 UTC 2010


On Sat, 06 Feb 2010 04:26:37 +0300, Алексей wrote:

Hey,

>I have been recently playing around handling binary files with Geany.
>At least Notepad++, which is also Scintilla-based, is able to do that
>(opens and saves binaries correctly). This feature looks very
>promising for me, as there are sometimes files with mixed content
>(e.g. Outlook forms, resource files or malformed e-mails).
>
>First, I've found a problem (seems that was partially due to my
>charset handling patch
>http://lists.uvena.de/geany-devel/2009-October/001480.html): when
>opening a binary (or malformed) file Geany would hang eating 100% CPU.
>My 1st patch is to fix that (tested for some cases, all worked... but
>should be checked once more).

Could you provide a test case to reproduce the problem?


>Then, I tried to make Geany open binaries correctly (the 2nd patch).
>What I did was:
> - Made encodings_convert_to_utf8 attempt to convert with "fast" flag
> set if nothing else succeeded (if Unicode checks failed while
> conversion itself succeeded)
> - Made encodings_convert_to_utf8 (in fact, its duplicate) return not
> only converted text, but also its length ('cause if a binary file
> contains nulls it would be truncated instead)
> - Made document_open_file_full use SCI_ADDTEXT instead of SCI_SETTEXT
> when showing file contents. The former is able to handle NULLs while
> the latter isn't
>
>Finally, I was able to view, edit and correctly save a binary file
>with NULLs. I've attached 2 screenshots for you to see what it looks
>like.

I don't see why we should support this. Geany is a text editor. Text
files don't contain NULL bytes. If you want edit binary files, hex
editors are more useful, regardless of what Notepad++ does.

And as you said, make such files opening isn't enough at all, there are
certainly many places in Geany which rely on the fact files are real
text files and I don't think this is wrong at all. Geany is a text
editor.


Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20100206/84dfadc6/attachment.pgp>


More information about the Devel mailing list