Search code examples
unicodegnomegnome-3giogjs

Unicode file I/O with Javascript and gjs?


Can anybody give any working example of how to read/write Unicode text files using Javascript and Gjs, possibly using Gio and/or Glib? I'm experienced in Javascript, but these APIs are still alien to me and being quite new technologies, googling is not helping much.

I've seen this one: https://live.gnome.org/Seed/Tutorial/Simple_file_io , but it is Seed based (not Gjs), and seems quite old. I'm getting errors (like too few arguments on Gio.read on line 9) and thus cannot test using Unicode text.

A working snippet will be much helpful. Thanks!

Update: I'm testing on Ubuntu 12.04 64bit.


Solution

  • To get a general idea, you can check the example gio-cat.js from gjs source code repository.

    You might also check the answer for "How to start writing Gnome Shell extensions", which has some links that can help you.