How can I create unicode console application with Delphi 2009?
If I do like this:
{$APPTYPE CONSOLE}
uses
SysUtils;
begin
writeln(\'öüğşç سيمانتت
Actually, there is a way to do this with standard WriteLn() calls, but it involves patching a bug in the Delphi 2009 RTL. The thing is, Delphi does some compiler magic for WriteLn. For UnicodeString arguments, this results in a call to _WriteUString. That method can be seen in System.pas, although you can't call it directly. In it you'll see a call to _WriteLString, but that method receives a AnsiString argument. So when this call is taking place, your UnicodeString is being downcasted to AnsiString.
The solution is, to change this UnicodeString->AnsiString cast into a UnicodeString->UTF8String cast.
Now, when you set the console to UTF8, all your characters will go through untouched (and yes, ofcourse you'll need a font with support for the characters you want to show) :
SetConsoleOutputCP(CP_UTF8)
For this RTL fix, you'll need to do some nifty code-hooking. I've done this already, and a collegue of mine is busy writing an article about this. I'll post a link once it's available online.
Cheers!