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 568705 - gtktextbuffer serialization decimal point/comma confusion
gtktextbuffer serialization decimal point/comma confusion
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
3.1.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2009-01-22 15:10 UTC by Tor Lillqvist
Modified: 2018-05-02 14:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Suggested patch (2.47 KB, patch)
2009-01-22 15:13 UTC, Tor Lillqvist
needs-work Details | Review

Description Tor Lillqvist 2009-01-22 15:10:39 UTC
serialize_value() in gtktextbufferserialize.c serializes double values using g_value_transform() which means that value_transform_double_string() gets used which simply uses g_strdup_sprintf() with a %f format. This means the serialized value has a locale-dependent decimal symbol.

deserialize_value() on the other hand deserializes double values using g_ascii_strtod() which accepts only a decimal point.

Clearly this means problems. The values of text attributes like "scale" don't get parsed correctly in a locale that uses decimal comma.

Mitch also said on IRC that "(if at all!) the code needs to check for a transformable type *last* in order to be as safe as possible against app-registered transform functions"
Comment 1 Tor Lillqvist 2009-01-22 15:13:10 UTC
Created attachment 127000 [details] [review]
Suggested patch
Comment 2 Christian Persch 2009-01-22 19:05:26 UTC
There's the G_ASCII_DTOSTR_BUF_SIZE for this.:

+      gchar buffer[50];
+      g_ascii_dtostr (buffer, sizeof (buffer), g_value_get_double (value));

Comment 3 Michael Natterer 2009-01-22 21:33:34 UTC
Yes, I've seen that too, but the code has other major issues
that need to be addressed. I'll patch them away in the next few
days.
Comment 4 Matthias Clasen 2011-06-01 02:56:22 UTC
That never happened, or did it ?
Comment 5 Michael Natterer 2011-06-01 07:17:56 UTC
Argh apparently not, I totally forgot. Will keep this browser tab open now :)
Comment 6 Matthias Clasen 2018-02-10 05:19:22 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 7 Matthias Clasen 2018-04-15 00:18:45 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
Comment 8 Michael Natterer 2018-04-15 15:46:00 UTC
Did I really forget this... sorry, reopening.
Comment 9 GNOME Infrastructure Team 2018-05-02 14:40:19 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/311.