[CDRIVER-3812] bson_as_json outputs illegal JSON for some locales Created: 02/Nov/20 Updated: 18/Sep/23 |
|
| Status: | Backlog |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Samantha Ritter (Inactive) | Assignee: | Roberto Sanchez |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | rb-track | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||
| Quarter: | FY25Q1 | ||||||||||||||||||||
| Description |
|
Many of the bson_as_json visitor functions delegate the work of converting a non-string value to a string to printf (by way of bson_string_append_printf). In certain locales, printf can return strings where a number with a floating point uses a comma instead of a period:
JSON does not accept comma separators in numeric types, only decimal point separators. |
| Comments |
| Comment by Fermín Galán [ 28/Apr/21 ] |
|
In the case it may be useful, https://jira.mongodb.org/browse/CDRIVER-3938 provides also a way of reproducing it.
|
| Comment by Roberto Sanchez [ 23/Dec/20 ] |
|
See attached example for a complete reproducer. This was provided by samantha.ritter. After some discussion, it seems that the most likely solution is to implement our own serialization function. There is a printf implementation which may serve as a useful reference in our own implementation. It may also be possible to adopt that implementation. |