Format Currency bug?

That’s not a bug if you’re using ToString. That’s how it’s defined.

I have a (possibly faulty) recollection that when I first started using Xojo and format(), it said explicitly that format strings were ASCII only. The doc is a bit more vague on that one now.

Where is the manual page explaining the change of the behavior of the formats?

Currently the result is said to be ascii encoded (see http://documentation.xojo.com/api/text/format.html)
I looked through some old versions and cant find where it ever said the format spec had to be ASCII only. Again I’d find that odd since Xojo is UTF-8 based and has been for well over a decade

Look at the doc page for format(), and look at the doc page for Integer.ToString. I’m not sure what “change” you refer to.

Format(fmt) works most of the time, using the parameters defined there, the toString(fmt) behaves differently, so it changes the usual fmt parameter.

Looks like we have ANOTHER inconsistency here.

1 Like

Well if the output string is ASCII encoded, then that automatically means your £ and € are not gonna work. I agree it’s odd, but perhaps they considered Format(), which uses Strings, as deprecated as we were supposed to be using Text - and therefore Integer.ToText, which takes a format string that works with UTF-8.

Its only been known about for 5 years, it’s not old enough to get fixed :wink:

<https://xojo.com/issue/39530>

4 Likes

talking about bugs and reporting them is “whining” ?

ok then

1 Like

It’s not clear to me that there is a bug.

Pardon me. But will need to say, you are using a bad argument. :smiley:

I have all the warnings set on, and I don’t receive a Format is deprecated, please use FFFF instead.

Xojo currently is a language where ALL Strings should be treated as UTF-8 unless the DEV chooses to convert to another format or import them from some alien environment , it was set as its UNICODE native format of choice, YEARS ago. Anything NOT WORKING as expected must be treated as BUGS. It’s not whining, it’s me protecting Xojo from themselves.

system.DebugLog(format(12.345, "\$#,###.##;(\$#,###.##)"))
           $12.35
system.DebugLog(format(12.345, "\£#,###.##;(\£#,###.##)"))
           £12.3

Clear enough?

1 Like

Imagine the financial damage people could have, if thousands of Pounds, silently, and unexpectedly, were failing some kind of “format” and going to databases and spreadsheets. The dev reads that “\char” is ok for format() in the manual, it even passes some of the tests, but how many of us know that \£ is not a mere “char”, its a “different kind” of char, and will fail if used instead of \$, or \#, that works, and should not be used in a language that should supposedly be able to handle it as you can write it as any other char in the IDE? A good part of Xojo public, isn’t the experts as many of us here, but the “I don’t know what UNICODE, or multibyte chars is, people”. 1+2 must be 3, “a”+“b” must be “ab”, and Format(12.35, “\£#,###.##;(\£#,###.##)”) must be £12.35

It wasnt Xojo but was a similar sort of screwy bug
The case I know of was 41 million in one day
Company went bankrupt and closed
Forensics found the issue

1 Like

Thank you all for your contributions, and please continue to add your thoughts but I’d be grateful if we didn’t get abusive or bad tempered about it.

From my point of view as a programmer of over 50 years experience I believe that the user should be delivered up something that is correct and as expected or should at least be told that there is a problem by the compiler - not runtime garbage.

Talk of having to hunt through documentation about UTFs etc is not acceptable. If it is wrong then a compiler error or warning should have been given. With no compiler error the results should have been consistent as expected.

Seriously I was trained by IBM Hursley Research Laboratories in 1967 and worked on their PL/1 compiler - and I have written at least three other compilers and two OS’s since then - one OS bug free and one compiler only one bug ever found.

Pleased to say that Xojo say they have fixed this and the fix is in test - guess it should appear at the next release.

Interestingly, if you look at <https://xojo.com/issue/39530> you’ll see that William reported that he fixed it few days ago. I hope that the Xojo testers find the fix ok and it reaches the R1.1.