nimrod-code/Aporia — Issue #4: Suspected ISO to UTF8 problem - Aporia does not handle non-UTF8 input properly, or so it seems, and fails to load the whole file.
Author: shevegen
Created: 2011-12-27 19:58:56+00:00
State: open

Hello.

As stated on IRC, this problem arises when my source file contains non-UTF8 characters.

Aporia will then report an error such as this here on the terminal:

Gtk-CRITICAL **: gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text, len, NULL)' failed

My file in question had something like this here as part of itself:

@default_colour = 'green' # gehört zwar nit dazu, aber zu reset.

Note the "ö" character, which is the german umlaut for "oe".

If that character is removed, the same file loads fine in Aporia.

This is not a important issue, but I regard it still as a bug in Aporia.

I propose to fix this in either (or all) of the following ways:

- When the encoding is invalid, notify the user about it in Aporia.

gedit is doing something similar, it display a red bar on the top and
tells you that the encoding is not as expected. And then you can
force load it, or assume another encoding. Aporia could at least
flash a little red warning bar or something to indicate this problem
of a wrongful encoding.

- Another way could be to automatically assume a certain Encoding
like ISO-*-1 or similar, when such an invalid character is encountered.

For instance, the Unix utilty "file" reports this about the file in question:

file question_answer.rb

question_answer.rb: Ruby script, ISO-8859 text

By the way, perhaps Aporia could get a new menu option, something
like Encoding, or "-> Set Encoding (to: Unicode, ISO etc..)

This is what Geany is doing.
Bluefish too, in a way. At least the file is loaded.

In my opinion, perhaps the default way for Aporia should be to
try to load the given file, even if there are errors, because right
now it refuses to load the whole file even if there is an error.