Bug #32294 wrong locale used in setlocale() calls

Submitted: 12 Nov 2007 20:40 Modified: 15 Nov 2007 6:13
Reporter: Jim Winstead Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51 OS:Any
Assigned to: Jim Winstead CPU Architecture:Any
Tags: setlocale

[12 Nov 2007 20:40] Jim Winstead
Description:
To properly handle decimal, float, and double values, the driver calls setlocale(LC_NUMERIC, "English") to reset the locale to a known value so the thousands separator will not be used and the decimal point will be ".".

But there is no locale called "English" on many non-Windows systems. We should be using the "C" locale, which exists everywhere.

This is actually a regression of very-old bug #371.

How to repeat:
Set the locale to something with a thousands separator or non-. decimal point, and then try using decimal, float, and double values.

Suggested fix:
s/English/C/

We should actually avoid this abuse of setlocale() entirely by reformatting the values as necessary. We already do this in one case (setting a decimal/float/double value from a SQL_C_CHAR or SQL_C_BINARY).
[12 Nov 2007 20:42] Jim Winstead
Use the correct locale

Attachment: bug32294.diff (text/plain), 1.80 KiB.

[13 Nov 2007 17:04] Jim Winstead
The fix for this bug has been committed, and will be in 3.51.22.
[13 Nov 2007 17:27] Susanne Ebrecht
bug #30900 is a duplicate of this bug here
[15 Nov 2007 6:13] MC Brown
A note has been added to the 3.51.22 changelog: 

The English locale would be used when formatting floating point values. The C locale is now used for these values.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.