GNOME Bugzilla – Bug 607625
Problem with libsoup and strings with odd-encodings?
Last modified: 2021-05-25 17:32:14 UTC
The following code should print the contents of the site (and works for the non-big5 http://www.google.com/), but it instead prints just the length/status. A similar C version works just fine... Gtk = imports.gi.Gtk; Soup = imports.gi.Soup; var session = new Soup.SessionAsync(); // Soup.URI is a struct. var uri = new Soup.URI.c_new("http://www.google.com.hk/"); var request = new Soup.Message({method:"GET", uri:uri}); var status = session.queue_message(request, function(ses,msg) { Seed.print(msg.response_body.length); // prints 8062 Seed.print(msg.response_body.data); // prints empty string. Seed.print(msg.status_code); // prints 200 // Seed.print(msg.request_body.data); }); Gtk.init(0, null); Gtk.main();
This is a known bug in libsoup-via-introspection; we're currently calling some strings "utf8", but really they're unknown-encoding and ought to be considered byte arrays. Except then they're harder to deal with in the very common ASCII-only case... I haven't quite figured out what I'm going to do here...
data should be tagged as (array) (element-type char) need to check http://live.gnome.org/GObjectIntrospection/Annotations and the source to see how struct info can handle the length property..
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new enhancement request ticket at https://gitlab.gnome.org/GNOME/seed/-/issues/ Thank you for your understanding and your help.