Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Money.to_string for locale"bn" gives: Regex.CompileError unknown POSIX class name at position 5 #178

Closed
Terbium-135 opened this issue Jan 24, 2025 · 7 comments

Comments

@Terbium-135
Copy link

I was just writing a small proof of concept and ran into this.
What am I doing wrong here?

While a conversion for :USD works as expected:

iex [11:39 :: 7] > Money.to_string!(Money.new!(:USD, "100"), locale: "bn")
"১০০.০০\u00A0US$"

That one failed:

iex [11:39 :: 8] > Money.to_string(Money.new!(:EUR, "100"), locale: "bn")
** (Regex.CompileError) unknown POSIX class name at position 5
    (elixir 1.18.2) lib/regex.ex:257: Regex.compile!/2
    (ex_cldr_numbers 2.33.4) lib/cldr/number/formatter/decimal_formatter.ex:1013: Cldr.Number.Formatter.Decimal.before_currency_match?/3
    (ex_cldr_numbers 2.33.4) lib/cldr/number/formatter/decimal_formatter.ex:600: Cldr.Number.Formatter.Decimal.assemble_parts/6
    (ex_cldr_numbers 2.33.4) lib/cldr/number/formatter/decimal_formatter.ex:582: Cldr.Number.Formatter.Decimal.assemble_format/4
    (ex_cldr_numbers 2.33.4) lib/cldr/number.ex:433: Cldr.Number.to_string/3
    iex:8: (file)
@kipcole9
Copy link
Owner

Wow, that's unexpected for sure. I won't be able to dive into this for a few hours but will resolve asap.

@Terbium-135
Copy link
Author

No rush Kip and thanks for investigating!

@kipcole9
Copy link
Owner

I've pushed a commit that fixes this issue. The issue is actually in ex_cldr_numbers.

Would you consider configuring that from GitHub to check before I publish an update?

Just add the following to your mix.exs in the deps function:

{:ex_cldr_numbers, github: "elixir-cldr/cldr_numbers", override: true},

@Terbium-135
Copy link
Author

I will and let you know the outcome.
Thank you for your time Kip

@Terbium-135
Copy link
Author

As far as I can tell this fixed it. Closing this issue
Thank you!

@kipcole9
Copy link
Owner

Thanks for testing - I'll publish a new release to hex now.

@kipcole9
Copy link
Owner

I've published ex_cldr_numbers version 2.33.5 with the following changelog entry:

Bug Fixes

  • Fix formatting currencies when the CLDR regex for "before currency match" is invalid in the Erlang regex engine. Thanks to @Terbium-135 for the issue. Closes ex_money issue #178.

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants