• Decimal comma instead of decimal point in JSONWriter.AppendValue

    By Johan Kanngard 2 decades ago

    When adding a Double, Single or Currency value with JSONWriter.AppendValue and the server (or client if in Notes) has a custom decimal symbol in regional setting in Windows, the wrong decimal symbol is used.

    Steps to reproduce in Domino:

    1. Open Regional Settings on the server
    2. Choose Customize in the Regional Options tab.
    3. Set comma (,) as Decimal symbol.
    4. Click OK.
    5. The server might have to restart.
    6. Create code:



      Dim jsonWriter As New JSONWriter()

      json = json + jsonWriter.BeginObject()

      json = json + jsonWriter.Key("decimalvalue")

      Dim value As Currency

      ' or Dim value As Single

      ' or Dim value As Currency

      value = 123.45

      json = json + jsonWriter.AppendValue(value)


    7. json contains {"decimalvalue":123,45"} but should contain {"decimalvalue":123.45"}





      Crude patch

      ' Added to members:

      Private m_decimalSeparator As String ' The decimal separator used on the system

      ' Added to sub New:

      m_decimalSeparator = Left(Cstr(Fraction(0.1)), 1)

      ' Changed in AppendValue:

      Case V_INTEGER, V_LONG, V_DOUBLE, V_CURRENCY, V_BYTE:

      sReturn = Join(Split(Cstr(p_vValue), m_decimalSeparator), ".")



      I guess there are more efficient ways of doing this though.
    • Bug in the bug report

      By Johan Kanngard 2 decades ago

      The return value should of course be:

      sReturn = sReturn & Join(Split(Cstr(p_vValue), m_decimalSeparator), ".")

      • The problem is solved in version 1.0.6a

        By Milos Lapis 1 decade ago