diff --git a/docs/changes.txt b/docs/changes.txt index adc9b79eb5..03eeb53fd3 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -236,6 +236,9 @@ Changes in behaviour not resulting in compilation errors, please read this! GetEventObject() in all ports but the frame the menu was attached to in wxMSW. Now all ports return the menu that was opened or closed as the event object. +- wxAny now uses C locale format for the floating point numbers and not the + current locale one, i.e. decimal point is always used. + Changes in behaviour which may result in compilation errors ----------------------------------------------------------- diff --git a/interface/wx/any.h b/interface/wx/any.h index de177e1430..e8b5c6da5f 100644 --- a/interface/wx/any.h +++ b/interface/wx/any.h @@ -48,6 +48,11 @@ object in heap for large objects (i.e. ones with size more than WX_ANY_VALUE_BUFFER_SIZE, which at the time of writing is 16 bytes). + @note When performing conversions between strings and floating point + numbers, the representation of numbers in C locale is always used. + I.e. @code wxAny("1.23").GetAs() @endcode will always work, + even if the current locale uses comma as decimal separator. + @library{wxbase} @category{data} diff --git a/src/common/any.cpp b/src/common/any.cpp index 074412c80e..cefcc2a1d8 100644 --- a/src/common/any.cpp +++ b/src/common/any.cpp @@ -453,7 +453,7 @@ bool wxAnyValueTypeImplDouble::ConvertValue(const wxAnyValueBuffer& src, } else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxString) ) { - wxString s = wxString::Format(wxS("%.14g"), value); + wxString s = wxString::FromCDouble(value, 14); wxAnyValueTypeImpl::SetValue(s, dst); } else