#33 Open file without encoding

closed
None
5
2006-11-11
2006-10-19
Armin Fuerst
No

If Geany can't detect the encoding of a file, it
either writes strange characters of even loops.
I attach a sample file like I commonly have to edit.
I guess the problem are "binary" characters (\x00-\x1F)
which I need in these files (and they make sense!),
although these are text-files.

Discussion

  • Armin Fuerst
    Armin Fuerst
    2006-10-19

    simple file for plain ASCII-editing

     
    Attachments
  • Enrico Tröger
    Enrico Tröger
    2006-10-23

    • assigned_to: nobody --> eht16
     
  • Enrico Tröger
    Enrico Tröger
    2006-10-23

    Logged In: YES
    user_id=1117045

    With SVN r920 you can at least open these files. There is a
    new encoding called "None" to do not do any character set
    conversions. You can choose Reload As from the file menu or
    use the new encoding drop down box in the file open dialog.
    This enables you to open such files in Geany and read them.
    More or less:
    The attached file is in my opinion no text file, because
    text files don't contain \0 bytes. And this is where Geany
    gets into trouble, if it reads a \0 byte, it thinks the file
    ended(more precisely the string into the file was read).
    Furthermore, Scintilla(the editor component) expects also \0
    byte terminated strings.
    So, Geany can't handle files which contain \0 bytes(at EOF
    it should be ok).

    You can also edit these files, but when you save them, they
    will be saved as UTF-8(probably) and will be truncated at
    the first found \0 byte. You have been warned.
    Sorry.

     
  • Enrico Tröger
    Enrico Tröger
    2006-10-23

    • status: open --> closed
     
  • Armin Fuerst
    Armin Fuerst
    2006-10-24

    Logged In: YES
    user_id=783137

    Is this the final solution? If yes, it is basically fine for
    me, but
    perhaps a more convenient solution would be a warning when
    opening
    the file that the file will be truncated or changed.
    With bigger files like that I had the problem that geany
    ended in a
    loop while opening. Will these files be opened with this
    solution?
    (I would have to set up a compile-environment on my windows
    machine
    to test the svn-version, which is too much effort for this
    simple
    question)

     
  • Armin Fuerst
    Armin Fuerst
    2006-10-24

    • status: closed --> open
     
  • Enrico Tröger
    Enrico Tröger
    2006-10-24

    Logged In: YES
    user_id=1117045

    Hi,

    it's the final solution for the moment as long as we don't
    find a better solution. To show a warning is a good idea, I
    think I will add this.

    Can you send me (please compressed) the file which caused
    the loop? I don't know if this is fixed.

    A recent win32 build of the SVN version(including mentioned
    fixes) can be found on
    http://files.uvena.de/geany/geany_svn_win32.zip. Please read
    http://lists.uvena.de/geany/2006-October/000506.html for
    more information.

    I would suggest to move further discussion to Geany's
    mailing list if you like to subscribe.

     
  • Armin Fuerst
    Armin Fuerst
    2006-10-25

    Logged In: YES
    user_id=783137

    Hi,

    The file with the loop is open able with the
    svn-version, but it truncates after the first
    \x00-byte. Tnx for the version and the quick
    solution.
    I'm not allowed to post the real file, because
    it contains confidential data of a customer.
    If you really look for a better solution,
    have a look at how vim solves this - currently
    the only editor I know to edit this type of
    file (I agree, this is not a classic text-file).

     
  • Enrico Tröger
    Enrico Tröger
    2006-10-25

    Logged In: YES
    user_id=1117045

    I'm sorry but I think I will let the code as it is now. I
    added a warning message when opening a file that could be
    truncated and set it also to read only to avoid unwanted
    data loss(the read only mode can be changed via the document
    menu).
    (Windows build not yet available)

     
  • Enrico Tröger
    Enrico Tröger
    2006-11-11

    • status: open --> closed