[OH4] State Description Issue with percentage value

Hello All,

I am on openHAB 4.0.1 on a Raspberry Pi 4.

I have some strange behavior here. I have two channels with type Number:Dimensionless. These are supposed to display a percent value so out of the channel it is displayed in e.g. 0.75.

Therefore I implemented a transformation script

(function(i) {
    return parseFloat(i) * 100;

which I thought scaled the value to 100%. So in the example above I would have expected 75, but the item says 7500.

If I change the script as follows to

(function(i) {
    return parseFloat(i) * 1;

the value fits. So with the script I can work the reason I don’t understand.

But now I want to add the % sign to my item, so I write in the state description of the item %d % the result looks like this.

Here ([OH3] State Description Issue with percentage value - #3 by ip-ua) I have found something ( %d%%) so it looks better but how do I get a space between number and unit so that it looks like all other percentages?

I use a stateDescription of: %.0f %%

I have also defined the Unit metadat to %