Skip to content

set_locale_radix ignored #371

@tidenhub

Description

@tidenhub

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions