Skip to content
This repository

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

rhertzog opened this Issue · 4 comments

3 participants

Raphaël Hertzog Ole Ernst
Raphaël Hertzog

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...

Ole Ernst

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."

Ole Ernst

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.


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

Ole Ernst

Should be fixed now (using GSettings).

Ole Ernst olebowle closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.