Hi,

I just noticed that the latest version of xournal (the master branch in 
github) stores values in the config file using the current locale, which 
means writing "1,5" instead of "1.5" on a German system. I saw that this 
behaviour has been intentionally introduced in

"2b74a01... Fix issues with commas in config file (bug #161)"

To me, it feels quite dangerous to have the config file format depending 
on the locale. Some more remarks:

- I saw that, when reading the config file, (the new version of) xournal 
accepts both, "1.5" and "1,5", independently of the locale. This makes 
it far less bad than I thought at the first moment. Nevertheless, I just 
run into trouble: I had saved the config with the latest version of 
xournal (so numbers got saved as "1,5") and then my old version of 
xournal couldn't read it anymore.

- I think I understood why 2b74a01 has been made: cleanup_numeric() 
should not be called for other things than numbers (otherwise one has 
bug #161), so since update_keyval() doesn't know whether its argument is 
a number, it's much easier to change parse_keyval_**() instead.



One solution would be (a) an additional argument to update_keyval(), 
saying whether cleanup_numeric() should be called or not. However, to 
me, creating a locale-dependent number and then manually "repairing" it 
sounds quite dangerous anyway (who knows whether even stranger locales 
exist), so I'd rather suggest to directly create a locale-independent 
number.

I'm not yet sure about the best way to do that:

(b) Temprorarily switch the locale, while calling g_strdup_printf()? 
Using g_strdup_vprintf() instead, we could create our own version of 
g_strdup_printf() which does that locale-switching automatically. Right 
now this seems like the best solution to me, but maybe I'm overlooking 
something.

(c) Use g_ascii_formatd() instead? I don't see a way to find out how big 
the buffer should be we need to allocate; therefore, for the moment, I'd 
tend to (a).


Any thoughts/opinions about this? I'm willing to implement any of those 
solutions if you agree.


Best,
       Immi





------------------------------------------------------------------------------
_______________________________________________
Xournal-devel mailing list
Xournal-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xournal-devel

Reply via email to