After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 637270 - Allow showing invalid UTF-8 text
Allow showing invalid UTF-8 text
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on: 700577 700581
Blocks:
 
 
Reported: 2010-12-14 23:06 UTC by Behdad Esfahbod
Modified: 2018-04-15 00:24 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Behdad Esfahbod 2010-12-14 23:06:34 UTC
Ideally it should render each broken byte as a hex box or something, with red background.  Pango can be made to make that easier.  There should also be API to query whether the buffer has invalid text in it.

When fetching the text (for saving), the original text should be returned.  Ie. invalid bytes should be retained.  That's the major difference with this proposal and what PangoLayout does with invalid text (replace each invalid byte with (guchar)-1).

See bug 502947 for background.
Comment 1 Claudio Saavedra 2013-05-18 17:05:58 UTC
There is bug 610969. Could that serve as a starting point for this?
Comment 2 Sébastien Wilmet 2013-05-18 19:02:32 UTC
(In reply to comment #1)
> There is bug 610969. Could that serve as a starting point for this?

g_utf8_make_valid() replaces the invalid chars by another thing. Here we want to remember the invalid bytes so when we load and save a file (with gedit for example), if it contains invalid chars, they are not lost.
Comment 3 Matthias Clasen 2013-05-18 23:29:36 UTC
I think the first step here should be to write a somewhat comprehensive test case.
Comment 4 Timothy Arceri 2013-10-03 22:56:37 UTC
*** Bug 700581 has been marked as a duplicate of this bug. ***
Comment 5 Matthias Clasen 2018-02-10 05:21:15 UTC
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
Comment 6 Matthias Clasen 2018-04-15 00:24:18 UTC
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla.

If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab:

https://gitlab.gnome.org/GNOME/gtk/issues/new