Aha, that is easier, thanks. GLib.Bytes.new_from_bytes doesn't seem to be used correctly - it takes at least an offset and a length parameter? What you want in this case, I think, is a ByteArray. See the documentation here: https://github.com/GNOME/gjs/blob/master/doc/ByteArray.md
GJS console is just an executable ("/usr/bin/gjs") with which you can execute a GJS script directly. On Sat, Jun 10, 2017 at 3:46 PM Michael Teuscher <mk.teusc...@gmail.com> wrote: > Huff, dont have a lot of experience with the gjs-console, but I can tell > you which line fails: > > > -> let bytes = GLib.Bytes.prototype.new_from_bytes(image.data); > This one is failing with JS ERROR: Error: Failed to convert UTF-8 string > to JS string: Invalid byte sequence > > I really dont know what is wrong with that line. > > > > 2017-06-11 0:35 GMT+02:00 <philip.chime...@gmail.com>: > >> Is it possible to make a minimal example which isolates the problem? For >> example, just a script that can be run with gjs-console instead of the >> whole shell extension? >> >> Your analysis seems plausible. Is the ostream.write_bytes() call trying >> to convert to UTF8? It should not be, if it's correctly annotated. >> >> >> >> On Sat, Jun 10, 2017 at 3:27 PM Michael Teuscher <mk.teusc...@gmail.com> >> wrote: >> >>> Hello, >>> >>> Thanks for your response, I published the program on my git server. >>> >>> https://git.scaly.ch/projects/TS/repos/gnome-spotlight/browse >>> >>> libsoup is returning a byte array but GIO (or something else) tries to >>> convert it to UTF 8 when I want to write it down into a file. >>> >>> Thanks a lot >>> >>> Regards >>> Michael Teuscher >>> >> >
_______________________________________________ javascript-list mailing list javascript-list@gnome.org https://mail.gnome.org/mailman/listinfo/javascript-list