| Issue 879: | geo.getCurrentPosition do not return good position on linux with locale fr_FR | |
| 2 people starred this issue and may be notified of changes. | Back to list |
Sign in to add a comment
|
What steps will reproduce the problem? 1. create a file test.html with the first example of http://code.google.com/apis/gears/api_geolocation.html 2. On linux launch firefox with locale fr_FR LANG=fr_FR firefox test.html 3. Close firefox 4. launch firefox with locale C LANG=C firefox test.html What is the expected output? What do you see instead? I expect the same output for fr_FR and C locale. But with locale fr_FR the latitude and longitude is truncated to the integer part 48,2 instead of 48.7xxx,2.2xxx What version of the product are you using? On what operating system? Gear 5.21 Linux grazy 2.6.29-1-686 #1 SMP Fri Apr 17 14:35:16 UTC 2009 i686 GNU/Linux Please provide any additional information below. |
||||||||||
,
Jul 01, 2009
I found the source of the problem. The problem is that jsoncpp assumes that the
locale is "C". The method "decodeDouble" use the french decimal separator which is
"," instead of ".".
Here a patch to switch to C locale during json parse.
--- third_party/jsoncpp/json_reader.cc (révision 3368)
+++ third_party/jsoncpp/json_reader.cc (copie de travail)
@@ -68,7 +68,11 @@
document_ = document;
const char *begin = document_.c_str();
const char *end = begin + document_.length();
- return parse( begin, end, root, collectComments );
+ char *saved_l = setlocale(LC_NUMERIC,"C");
+ bool result =parse( begin, end, root, collectComments );
+ setlocale(LC_NUMERIC,saved_l);
+
+ return result;
}
|
|||||||||||
,
Jul 08, 2009
Thanks for investigating this Nicolas. I'll look into whether it's safe to always use the C locale in decodeDouble, and whether it's better to use the C locale throughout jsoncpp.
Status: Accepted
Owner: stevebl...@google.com |
|||||||||||
,
Nov 06, 2009
Fixed with change http://code.google.com/p/gears/source/detail?r=3409
Status: Fixed
|
|||||||||||
|
|
|||||||||||