View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0024011 | FPC | RTL | public | 2013-03-07 15:09 | 2013-03-14 14:48 |
Reporter | Bernard Marcelly | Assigned To | Marco van de Voort | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | no change required | ||
Platform | X86 | OS | Windows XP | ||
Product Version | 2.6.0 | ||||
Summary | 0024011: Thousand separator does not follow regional preferences | ||||
Description | Reproduced on Windows XP and Windows 8, on two computers with fr-FR regional preferences : Thousand separator used is : space Decimal separator used is : comma ShowMessage( Format('%10.0n', [1234567.0]) ) displays: 1?234?567 Delphi 7 on the same computer correctly gives : 1 234 567 ShowMessage( IntToStr(ord(ThousandSeparator)) ) displays : 160 instead of 32 | ||||
Steps To Reproduce | ShowMessage( Format('%10.0n', [1234567.0]) ) ShowMessage( IntToStr(ord(ThousandSeparator)) ) | ||||
Additional Information | FYI : Decimal separator is correctly handled by Format() and by DecimalSeparator. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | |||||
FPCOldBugId | |||||
FPCTarget | |||||
Attached Files |
|
|
Hello, Your ThousandSeparator is not an space, but maybe a "non-breakable-space" which is outside of ASCII charset, so you are using an ANSI string as an UTF8 one. Try this: ShowMessage(AnsiToUTF8(Format('%10.0n', [1234567.0]))); Space should not be used as thousand separator or some values will be splitted across line changes. The same happends with euro symbol in currency formats. |
|
I can reproduce: Lazarus 1.1 r40358M FPC 2.7.1 r23627 x86_64-linux-qt openSuSE 12.2, KDE4.8.5 In a project with unit "clocale" added to "uses" of *.lpr file. In system settings, I have no separator for numbers and "." for money. I don't know where "clocale" digs the info. EDIT: BTW, this FPC issue. |
|
FPC functions do not return utf8 by default (yet). So this is per spec. clocale links to libc for the data. |
|
Close then? 160 seems to be expected answer atm for a nonbreaking space? |
|
Not clear what should be fixed FPC side. Last call before closing. |
|
Sorry for the delay... 160 is the code for non-breaking space in ANSI as well as Unicode, see http://ascii-table.com/ansi-codes.php But then the problem is the display of the character 0000160. It should display as a space, not as a '?'. Furthermore I found an inconsistency in displays: (character pound shows bad in the report, read pound160) ShowMessage('AB' +0000160 +'C') displays AB ShowMessage('AB' +0000160 +'CD') displays AB ShowMessage('AB' +0000160 +'CDE') displays AB?CDE |
|
ShowMessage is Lazarus and requires UTF8. |
|
Yes, which is why I moved it to Lazarus. But you tossed it back. FPC still delivers ansi (or default 1-byte encoding, in the case of *nix) in every function. If you want to output UTF8, you need convert it. Which was my point for closing with "not a bug" status. |
|
> Yes, which is why I moved it to Lazarus. But you tossed it back. Because it is not a bug on Lazarus as well. LCL=UTF8. Programmer needs to deal with that. B.t.w. I replied to Bernard, trying to point out it is not a bug, it's a feature. So actually I tried to tell him you were right: resolve as "no change required". |
|
So what is the solution? Also: writeln((Format('%10.0n', [1234567.0]))); writeln(AnsiToUTF8(Format('%10.0n', [1234567.0]))); outputs: 1�234�567 1?234?567 Lazarus 1.1 r40358M FPC 2.7.1 r23627 |
|
Resolved as discussed. Vojtech: be careful that your way to debug (writeln) doesn't introduce other codepage issues. Recommend to continue discussion/question on maillist or forum. |
|
I agree, no change required. But the problem is not simple, see my last note at http://lazarus.freepascal.org/index.php/topic,20163.0.html |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-03-07 15:09 | Bernard Marcelly | New Issue | |
2013-03-07 16:24 | José Mejuto | Note Added: 0066093 | |
2013-03-07 17:01 | Marco van de Voort | Project | FPC => Lazarus |
2013-03-07 18:14 | Vojtech Cihak | Note Added: 0066097 | |
2013-03-07 18:32 | Vojtech Cihak | Note Edited: 0066097 | View Revisions |
2013-03-07 20:11 | Marco van de Voort | Note Added: 0066101 | |
2013-03-07 20:12 | Marco van de Voort | Note Edited: 0066101 | View Revisions |
2013-03-07 20:12 | Marco van de Voort | Note Edited: 0066101 | View Revisions |
2013-03-12 16:26 | Bart Broersma | Project | Lazarus => FPC |
2013-03-12 22:09 | Marco van de Voort | Note Added: 0066202 | |
2013-03-13 12:49 | Marco van de Voort | Note Added: 0066211 | |
2013-03-13 12:49 | Marco van de Voort | Assigned To | => Marco van de Voort |
2013-03-13 12:49 | Marco van de Voort | Status | new => feedback |
2013-03-13 13:39 | Bernard Marcelly | Note Added: 0066212 | |
2013-03-13 13:39 | Bernard Marcelly | Status | feedback => assigned |
2013-03-13 13:42 | Bernard Marcelly | Note Edited: 0066212 | View Revisions |
2013-03-13 15:23 | Bart Broersma | Note Added: 0066217 | |
2013-03-13 17:32 | Marco van de Voort | Note Added: 0066219 | |
2013-03-13 21:50 | Marco van de Voort | Note Edited: 0066219 | View Revisions |
2013-03-13 21:50 | Marco van de Voort | Note Edited: 0066219 | View Revisions |
2013-03-13 23:32 | Bart Broersma | Note Added: 0066223 | |
2013-03-14 01:17 | Vojtech Cihak | Note Added: 0066224 | |
2013-03-14 10:21 | Marco van de Voort | Note Added: 0066226 | |
2013-03-14 10:21 | Marco van de Voort | Status | assigned => resolved |
2013-03-14 10:21 | Marco van de Voort | Resolution | open => no change required |
2013-03-14 14:48 | Bernard Marcelly | Note Added: 0066228 | |
2013-03-14 14:48 | Bernard Marcelly | Status | resolved => closed |