You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using draco within my project as a library to enable exporting meshes directly to DRC, OBJ, PLY, etc.
If I set the program locale to the system default as follows:
setlocale(LC_ALL, ".UTF8");
and then I use the obj_encoder functions to save a mesh to an OBJ file, the result is unusable, as OBJ requires a . decimal separator, and the system default is set to a locale which uses ,.
I can get around this by adding another line to override the numeric locale:
setlocale(LC_NUMERIC, "en_US.UTF8");
However, I should not be required to do so, as this affects all floating point string conversions application wide.
The text was updated successfully, but these errors were encountered:
This is still an issue in the latest release (1.5.7). I must still use the work around outlined above to ensure I get period decimal separators when my system is set to a region that uses a comma decimal separator.
Looking at the OBJ encoder code, I see the following in obj_encoder.cc
void ObjEncoder::EncodeFloat(float val) {
// Use %F instead of %f to make the floating point non-locale aware.
snprintf(num_buffer_, sizeof(num_buffer_), "%F", val);
buffer()->Encode(num_buffer_, strlen(num_buffer_));
}
Both of thesesources do not mention anything about the uppercase F vs lowercase f having anything to do with locale, but rather whether or not to print things like infinity or NAN in upper or lower case.
I am using draco within my project as a library to enable exporting meshes directly to DRC, OBJ, PLY, etc.
If I set the program locale to the system default as follows:
and then I use the obj_encoder functions to save a mesh to an OBJ file, the result is unusable, as OBJ requires a
.
decimal separator, and the system default is set to a locale which uses,
.I can get around this by adding another line to override the numeric locale:
However, I should not be required to do so, as this affects all floating point string conversions application wide.
The text was updated successfully, but these errors were encountered: