Bug #41008

f:format.currency should use trim

Added by Cedric Ziel about 9 years ago. Updated about 8 years ago.

Should have
Target version:
Start date:
Due date:
% Done:


Estimated time:
Has patch:


Hello; if you use an IDE and use their reformat feature, you have the problem that viewhelpers get splitted up into several lines just like in the example:

<f:format.currency currencySign="€" decimalSeparator="," thousandsSeparator=".">

This results in non-supported chars for format_number.

The Viewhelper therefore should trim before calling number_format:

number_format(trim($stringToFormat), 2, $decimalSeparator, $thousandsSeparator);

Updated by Adrian Föder about 9 years ago

  • Status changed from New to On Hold

voted down because: if the value must not have whitespaces, it... must not have whitespaces.

Especially your IDE is misconfigured then, because it would also break inline html elements, for example.
To workaround, either use the inline variant or check whether to fix the IDE.
Generally, I personally discourage XML autoformatting because it mostly results worse than intended (especially since whitespaes in HTML have special impacts; other than in XML)

//edit: some additional word; of course we could just add a trim() here; but this would be a special treatment there compared to the other ViewHelpers and therefore add inconsistencies.
I tend to keep the ViewHelpers, regarding to their HTML behavior, mostly "as-is"; meaning: if you surround something with whitespaces, the whitespaces will stay there without "magic" disappearance.

If you want to split the very long line into more, you could do


Updated by Cedric Ziel about 9 years ago

For inline Notation, this is true, but this behavior is simply not expected in explicit Markup.

HTML ignores such Chars in most cases, FLUID uses HTML Notation. Failing for those errors is very annoying and could easily be suppressed by adding standard-trim.


Updated by Sebastian Kurfuerst about 9 years ago

  • Status changed from On Hold to Rejected

I agree with Adrian's comments; I'd use the inline notation in this case:

{object.amount -> f:format.currency(currencySign:'€', decimalSeparator: ',', thousandsSeparator: '.')}

Adding some "trim" behavior would be very inconsistent with the way Fluid works now and is expected to work. We leave whitespaces completely untouched.

Greets, Sebastian


Updated by Cedric Ziel about 9 years ago

I'm okay with that :-)
were just my two cents.

Thanks for clarification. Maybe the docs should point that out more clearly? I think this issue is mostly about formatters which would break if someone insists on using them explicitly.


Also available in: Atom PDF