PyRFC icon indicating copy to clipboard operation
PyRFC copied to clipboard

set_locale_radix ignored

Open tidenhub opened this issue 7 months ago • 1 comments

I have set the locals to a language with a comma as a decimal separator, like "de_DE".

If I set set_locale_radix(".") I would expect that {"RFCFLOAT": "1.2"} could be parsed without errors.

But I'm getting the error pyrfc._exception.ExternalRuntimeError: 22 (rc=22): key=RFC_CONVERSION_FAILURE, message=Cannot convert string value 1.2 at position 1 for the field RFCFLOAT to type RFCTYPE_FLOAT [MSG: class=, type=, number=, v1-4:=;;;]

To Reproduce Describe the steps to reproduce the behavior, including test script.

        setlocale(LC_ALL, "de_DE", )
        set_locale_radix(".")
        IMPORTSTRUCT = {"RFCFLOAT": "1.2"}
        output = client.call(
            "STFC_STRUCTURE",
            IMPORTSTRUCT=IMPORTSTRUCT,
        )["ECHOSTRUCT"]
        assert output["RFCFLOAT"] == 1.2

Aditional informaiton If I replace set_locale_radix with locale.setlocale(locale.LC_NUMERIC, "en_GB.UTF-8") the script runs without any errors.

Environment

  • OpenSUSE Leap 15.6
  • Running in virtualenv
  • PyRFC==3.3.0

tidenhub avatar Jul 04 '24 05:07 tidenhub