Re: Javascript unicode problem
- From: "Norman L. Smith" <nls1729 gmail com>
- To: Sam Bull <sam hacking sent com>
- Cc: gnome-shell-list gnome org
- Subject: Re: Javascript unicode problem
- Date: Wed, 26 Dec 2012 14:22:17 -0500
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.
https://bugzilla.gnome.org/show_bug.cgi?id=680730
https://mail.gnome.org/archives/gnome-shell-list/2012-July/msg00143.html
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.
Regards,
Norman
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
> https://mail.gnome.org/mailman/listinfo/gnome-shell-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]