Configuration file is rewritten in ISO-8859-1 and then presets are no longer visible #6

rhertzog opened this Issue Aug 30, 2011 · 4 comments


None yet

3 participants


I setup a configuration file with the following presets entries:

  "presets": {
    "presets": {
      "petite pause (5 mn)": 300,
      "grande pause (12 mn)": 720,
      "séance travail (25 mn)": 1500

Notice the use of one accented character. The file is written in UTF-8 encoding. Now I restart gnome-shell. I see my presets, they are OK. I modify the duration in "Set Timer" to force a rewrite of the configuration file and now the configuration file is in ISO-8859-1 instead of UTF-8. I restart gnome-shell, the presets are no longer visible in the menu...


I can confirm this bug. The problem seem to be in the JSON.parse function. Because if you put the following lines after JSON.parse in line 353

global.log(jsondata["presets"]["presets"]["petite pause (5 mn)"]);
global.log(jsondata["presets"]["presets"]["grande pause (12 mn)"]);
global.log(jsondata["presets"]["presets"]["séance travail (25 mn)"]);

the output is as follows:


Of course both files (extension.js and gnome_shell_timer.json) being UTF-8 encoded.

Which is strange because RFC4627 says "JSON text SHALL be encoded in Unicode. The default encoding is UTF-8."

olebowle commented Sep 5, 2011

I'm going to port that json configuration to GSettings. I just haven't figured how to read an GSettings dict (type a{su}) and iterate over it in javascript. If someone knows how please let me know.
Won't be here for 1.5 weeks, so it won't happen 'til then.


codito commented Sep 6, 2011

I have filed Bug 658312 for the issue with GLib.file_set_contents.

olebowle commented Nov 2, 2011

Should be fixed now (using GSettings).

@olebowle olebowle closed this Dec 4, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment