I want to output a float price using a language constant like this:

MYCONST_VAT="incl. %.2f&#37 VAT"

So doing this:

echo Text::sprintf('MYCONST_VAT', 19);


incl. 19.00% VAT

The problem is if sending Joomla mails using constants like that, the mails display the output like this:

incl. 19.00&#37 VAT

1 Answer 1


You are missing a semicolon at the end of the entity and also such string would need to be run through html_entity_decode(). However, the correct and much simpler way to escape the % character in sprintf() is using the % character:

MYCONST_VAT="incl. %.2f%% VAT"
  • That was the first thing i did, but then i get the error, a second argument is missing.
    – maidan
    Commented Mar 20, 2023 at 14:50
  • I can't reproduce the issue. Are you sure you used %% correctly?
    – Sharky
    Commented Mar 24, 2023 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.