在Delphi 2009中的Unicode控制台应用程序 [英] Unicode Console Application in Delphi 2009

查看:107
本文介绍了在Delphi 2009中的Unicode控制台应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Delphi 2009创建unicode控制台应用程序?

How can I create unicode console application with Delphi 2009?

如果我这样做:

{$APPTYPE CONSOLE}
uses
  SysUtils;
begin
  writeln('öüğşç سيمانتت');
end.

我得到以下结果:

ougsc ???????


推荐答案

我不确定这是什么之后,但您可以通过使用Windows API函数在所有32位Delphi版本中创建Unicode控制台应用程序。我刚刚尝试过Delphi 4:

I'm not sure that is what you're after, but you can create Unicode console applications in all 32-bit Delphi versions by using the Windows API functions. I just tried with Delphi 4:

program test;

{$APPTYPE CONSOLE}

uses
  Windows;

var
  s: WideString;
  i: integer;
  Written: Cardinal;
begin
  SetLength(s, 80);
  for i := 1 to 80 do
    s[i] := WideChar(48 + i);
  WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), PWideChar(s), 80, Written,
    nil);
end.

我没有Delphi 2009来尝试如何在编辑器中输入Unicode字符串...

I don't have Delphi 2009 to try how entering Unicode strings in the editor works...

这篇关于在Delphi 2009中的Unicode控制台应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆