Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rhertzog opened this issue Aug 30, 2011 · 4 comments

Comments

@rhertzog
Copy link
Contributor

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

@olebowle
Copy link
Owner

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:

300
720
undefined

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
Copy link
Owner

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.

Cheers

@codito
Copy link

codito commented Sep 6, 2011

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

@olebowle
Copy link
Owner

olebowle commented Nov 2, 2011

Should be fixed now (using GSettings).

@olebowle olebowle closed this as completed Dec 4, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants