craftcms / commerce

Fully integrated ecommerce for Craft CMS.
https://craftcms.com/commerce
Other
215 stars 169 forks source link

[4.x]: commerceCurrency formatting "?" instead of "." #3447

Closed WHITE-developer closed 3 months ago

WHITE-developer commented 3 months ago

What happened?

Description

We are using commerceCurrency twif filter for formatting the order price. But in the french language the "." is removed. In the order invoice PDF the "." is replaced by a "?". PDF behavior: image Cart behavior: image

Steps to reproduce

  1. {{ order.total|commerceCurrency(order.currency) }}
  2. "order.currency" is "EUR"
  3. language is french

Expected behavior

Displaying the price in the french language as X.XXX,XX€

Actual behavior

The price is displaying in the french language as X?XXX,XX€

Craft CMS version

4.8.0

Craft Commerce version

4.5.2

PHP version

8.2.10

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

No response

linear[bot] commented 3 months ago

PT-1589 [4.x]: commerceCurrency formatting "?" instead of "."

nfourtythree commented 3 months ago

Hi @WHITE-developer

Thank you for your message, I have just added a test for this to see what might be happening: https://github.com/craftcms/commerce/commit/ff0563d370006b694e509e862c090e53b3fbe594

I think this could be an issue with a non-breaking space character. The i18n formatter seems to return the values with those characters for the French language, which does make sense as you wouldn't want the string wrapping when output.

Guessing here, a combination of the font and the PDF rendering is causing the character to show differently?

Could you try stripping/replacing those characters in the PDF template?

Thanks

WHITE-developer commented 3 months ago

Hi @nfourtythree,

Thanks for the help! We have found the problem "Dompdf" used to format a "narrow nsbp;" to a "&nsbp;" and in the newer version it leaves a "narrow nsbp;" our pdf font does not support it and when we changed font, it displayed correctly.