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

查看:18
本文介绍了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天全站免登陆