Skip to content

Use unicode invariant locale in __changeCase function #5723

@vlsi

Description

@vlsi

Use case

__changeCase was introduced in #4587, and it uses locale-dependent conversion. It makes it prone to errors.

Kotlin recently switched to invariant locale when the user provides no locale: https://youtrack.jetbrains.com/issue/KT-43023
In other words, "i".uppercase() yields I even in tr_TR locale.

Currently org.apache.jmeter.functions.ChangeCaseSpec fails in tr_TR locale as follows:

FAILURE   0,4sec, org.apache.jmeter.functions.ChangeCaseSpec > convert 'simple' using mode upper to 'SIMPLE'
    Condition not satisfied:
    
    output == changeCase.execute(result, null)
    |      |  |          |       |
    SIMPLE |  |          S?MPLE  org.apache.jmeter.samplers.SampleResult@7cbebcbf
           |  <org.apache.jmeter.functions.ChangeCase@42db1106 values=[org.apache.jmeter.engine.util.CompoundVariable@73ae7e9c, org.apache.jmeter.engine.util.CompoundVariable@66f7d246]>
           false
           1 difference (83% similarity)
           S(I)MPLE
           S(?)MPLE

Possible solution

Add an extra parameter to __changeCase so the user can specify the locale. A special value of default could designate Locale.getDefault().

Possible workarounds

Skip ChangeCaseSpec in tr_TR locale.

JMeter Version

5.5

Java Version

No response

OS Version

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions