View Issue Details

IDProjectCategoryView StatusLast Update
0016846FPCRTLpublic2013-04-11 08:41
ReporterTomas Hajny Assigned ToJonas Maebe  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionduplicate 
PlatformWin32 (or Win64)OSMS Windows 
Product Version2.4.0 
Summary0016846: Console output with unit Crt always using ANSI codepage
DescriptionThere is no possibility to perform output using other codepages than the current ANSI codepage (e.g. using the traditional "OEM" aka IBM codepages is not possible any longer, which is especially problematic with a TP/BP compatibility unit Crt since OEM aka IBM codepages were exactly those used with TP/BP compiled programs under MS-DOS).
Steps To ReproduceOpen a command prompt.
Run 'chcp 437'.
Run the following program:

begin
 WriteLn ('Square root: ', Chr (251));
end.

Now run the following program:

uses
 Crt;
begin
 WriteLn ('Square root: ', Chr (251));
end.

You see that the output differs depending on whether unit Crt is used or not. You can also see that the square root character (ASCII 251 in the original IBM codepage 437) is properly displayed in the first case but not in the second case.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId0
FPCTarget
Attached Files

Relationships

duplicate of 0016064 new [windows] adding "uses crt" causes implicit code page conversion 
related to 0006785 closedFlorian crt garbles writeln() output 
related to 0024257 new Patch 007976 of Crt is incorrect 

Activities

Maxim Ganetsky

2010-07-05 22:03

reporter   ~0039048

Last edited: 2010-07-05 22:19

Of course my patch is problematic, but I couldn't find a better solution. Do you have any better idea? Note that the following program IMO should work in default Windows XP console (without changing fonts etc.):

uses
 Crt;
begin
 WriteLn ('Тестовая строка');
end.

Tomas Hajny

2010-07-07 23:43

manager   ~0039123

Your test sequence should indeed work as long as the test string in the source file is encoded using the same codepage as used in the particular console window. I'm no Win32 expert, so I don't know what would be the best way for making it to work right now apart from suggesting that Crt should preferably not fiddle with codepage settings at all. Moreover, I don't use / own any WinXX, so I can only play with it if I bring my work machine home and find some time for experimenting with it. Nevertheless, I'm willing to have a look at it if noone else solves it before, but it would surely take some time.

Issue History

Date Modified Username Field Change
2010-07-05 21:49 Tomas Hajny New Issue
2010-07-05 21:49 Tomas Hajny FPCOldBugId => 0
2010-07-05 21:52 Tomas Hajny Relationship added related to 0006785
2010-07-05 22:03 Maxim Ganetsky Note Added: 0039048
2010-07-05 22:05 Maxim Ganetsky Note Edited: 0039048
2010-07-05 22:19 Maxim Ganetsky Note Edited: 0039048
2010-07-07 23:43 Tomas Hajny Note Added: 0039123
2010-07-10 14:38 Jonas Maebe Relationship added duplicate of 0016064
2010-07-10 14:38 Jonas Maebe Duplicate ID 0 => 16064
2010-07-10 14:38 Jonas Maebe Status new => resolved
2010-07-10 14:38 Jonas Maebe Resolution open => duplicate
2010-07-10 14:38 Jonas Maebe Assigned To => Jonas Maebe
2010-11-26 13:57 Jonas Maebe Status resolved => closed
2013-04-11 08:41 Tomas Hajny Relationship added related to 0024257