You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_locale.c 674 B

12345678910111213141516171819202122232425262728293031
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stddef.h>
  4. #include <string.h>
  5. #include <assert.h>
  6. #include "config.h"
  7. #include "json.h"
  8. #include "json_tokener.h"
  9. #ifdef HAVE_LOCALE_H
  10. #include <locale.h>
  11. #endif /* HAVE_LOCALE_H */
  12. int main(int argc, char **argv)
  13. {
  14. json_object *new_obj;
  15. #ifdef HAVE_SETLOCALE
  16. setlocale(LC_NUMERIC, "de_DE");
  17. #else
  18. printf("No locale\n");
  19. #endif
  20. MC_SET_DEBUG(1);
  21. new_obj = json_tokener_parse("[1.2,3.4,123456.78,5.0,2.3e10]");
  22. printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
  23. printf("new_obj.to_string()=%s\n", json_object_to_json_string_ext(new_obj,JSON_C_TO_STRING_NOZERO));
  24. json_object_put(new_obj);
  25. }