Re: Writing a buffer with UTF-8 content.



On Fri, Jul 27, 2012 at 11:01 PM, Ray Strode <halfline gmail com> wrote:
> Hey,
>
> On Fri, Jul 27, 2012 at 9:03 PM, Yaa101 <yaa101 xs4all nl> wrote:
>> There is definitely a problem in either the javascript string binding
>> with keyfile.to_data() or the one where GLib.file_set_contents() writes
>> to the file.
> I had a quick look at your test case this now.  I modified it to sleep
> 5 seconds, then attached with GDB and found there is a problem in gjs.
>
>> I hope somebody will file this as a bug as I am not able to, besides, I
>> will be too busy porting my application to python.
Also, this change to your test case:

                                                          const
ByteArray = imports.byteArray;

                                                          // log to
stdout and write new file as gedit-out.desktop
                                                          let [data,
datalen] = keyfile.to_data();
                                                          let array =
ByteArray.fromString(data);
                                                          log(data);
                                                          log(datalen);
                                                          let success
= GLib.file_set_contents(here + '/gedit-out.desktop', array, -1);
                                                          log(success);

seems to work around the bug (in case you'd rather not rewrite in python)

--Ray


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]