Skip to content

Empty money type for RTL languages #44959

Closed
@mparvazi

Description

@mparvazi

Symfony version(s) affected

6

Description

The money type for RTL languages is empty.
This bug happens in PrestaShop BackOffice: PrestaShop/PrestaShop#27051

en-US:

147068947-3ed71d44-45c4-409d-98d9-3b6e80d46317

Money type: $

fa-IR:

147069022-bff260ea-5ec7-4bb7-9315-fa1ab889837e

Money type: null
Must be: ریال

How to reproduce

https://github.com/symfony/symfony/blob/6.1/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php

148698756-150eccb0-021c-4f78-ba96-ac5bdc9b05a7

When shop language is RTL, the numerical digits for currency are in the form of Unicode: ۱۲۳

۱ => U+06F1
۲ => U+06F2
۳ => U+06F3

But preg_match pattern designed to find ASCII digits (i.e. 123)

/^([^\s\xc2\xa0]*)[\s\xc2\xa0]*123(?:[,.]0+)?[\s\xc2\xa0]*([^\s\xc2\xa0]*)$/u

Possible Solution

No response

Additional Context

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