Re: Javascript unicode problem

Hello Sam:

I remembered seeing something similar to your issue in the 
gnome-shell-list.  I think the following links might be
helpful to you.

In the bug report the following appears to be a workaround that
you could use.

Comment 13 Colin Walters [developer] 2012-11-29 04:27:47 UTC 

let byteData = imports.byteArray.fromString(data, "UTF-8");
GLib.file_set_contents('gedit.desktop', byteData, byteData.length);

I hope this info is of use.


On Wed, 2012-12-26 at 11:34 +0000, Sam Bull wrote:
> Hi guys,
> I hope this is the right place to post, I'm working on a shell
> extension, and need help with a few points to finish it up.
> The most pressing concern, before I can consider the extension usable,
> is when saving data to a file.
> I have used GLib.file_get_contents() to get the contents of a file, and
> this works fine, converting it into a string I can use this for my
> extension without a problem (everything works as expected).
> The issue is when I save the data back into a file with
> GLib.file_set_contents(), this causes the data to be corrupted on
> non-ASCII characters. If I'm not mistaken, it appears to be losing the
> first byte of any 2 byte character.
> Do I need to do something to convert the string to another format or
> anything, to make this work?
> Thanks for any help,
> Sam Bull
> _______________________________________________
> gnome-shell-list mailing list
> gnome-shell-list gnome org

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