View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0021986FPCCompilerpublic2012-05-08 14:412012-05-08 19:44
ReporterThaddy de Koning 
Assigned ToJonas Maebe 
StatusclosedResolutionno change required 
PlatformOSOS Version
Product Version2.7.1Product Build21254 
Target VersionFixed in Version 
Summary0021986: (unicodestring mode) AnsiStrings do not carry codepage info

  A: AnsiString;
  F: UTF8String;
  S: String;
  writeln('compiled with '+{$IFDEF FPC}'FPC'{$ELSE}'Delphi'{$ENDIF});
  A:= 'Tiburón';
  F:= 'Tiburón';
  S:= 'Tiburón';
  Writeln('AnsiString: ',A,' ',StringCodePage(A));
  Writeln('UTF8String: ',F,' ',StringCodePage(F));
  Writeln('Default string: ',S,' ',StringCodePage(S));
Expected output (XE2) is:
compiled with Delphi
AnsiString: Tiburón 1252
UTF8String: Tiburón 65001
Default string: Tiburón 1200

Real output is:
compiled with FPC
AnsiString: Tiburón 0
UTF8String: Tiburón 65001
Default string: Tiburón 1200
Steps To ReproduceCompile example in Delphi XE2
Compile example with trunk.
Compare output
TagsNo tags attached.
Fixed in Revision
Attached Files

- Relationships

-  Notes
Jonas Maebe (manager)
2012-05-08 14:57
edited on: 2012-05-08 15:30

{$modeswitch unicodestrings} only changes the default reference counted string type into unicodestring, char into widechar and pchar into pwidechar.

The codepage behaviour is influenced by {$modeswitch systemcodepage}. You can use the new {$mode delphiunicode} mode to activate both at the same time (and any future mode switches that may be added for compatibility with Delphi unicode).

It is known that currently, on Unix platforms all ansistrings will always have code page 28591 (ISO-8859-1) when using {$modeswitch systemcodepage} and not explicitly setting the code page of the source file. We are still looking in how to solve that.

Jonas Maebe (manager)
2012-05-08 14:58

And please always mention the OS you used, even if you think it doesn't matter.
Thaddy de Koning (reporter)
2012-05-08 19:44

I wasn't aware of the codepage switch or the mode delphi unicode.
This works indeed as I expected. tnx.

- Issue History
Date Modified Username Field Change
2012-05-08 14:41 Thaddy de Koning New Issue
2012-05-08 14:57 Jonas Maebe Status new => resolved
2012-05-08 14:57 Jonas Maebe Resolution open => no change required
2012-05-08 14:57 Jonas Maebe Assigned To => Jonas Maebe
2012-05-08 14:57 Jonas Maebe Note Added: 0059397
2012-05-08 14:58 Jonas Maebe Note Added: 0059399
2012-05-08 15:30 Jonas Maebe Note Edited: 0059397
2012-05-08 19:44 Thaddy de Koning Status resolved => closed
2012-05-08 19:44 Thaddy de Koning Note Added: 0059410

MantisBT 1.2.12[^]
Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker