'اردوویکیپیڈیا'显示'? ?在delphi编辑器? [英] 'اردو ویکیپیڈیا' showing '? ?' in delphi editor?

查看:90
本文介绍了'اردوویکیپیڈیا'显示'? ?在delphi编辑器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将消息框项目显示为اردوویکیپیڈیا,这是一个unicode角色;我正在使用Delphi 7;但在编辑器中显示为????? ?????,它不支持unicode;



任何人都可以告诉我在Delphi编辑器或项目中需要做什么才能使它与unicode兼容?

代码

MessageBoxW(0,''اردوویکیپیڈی'',''Print_info'',MB_OK);



这显示为

MessageBoxW(0,''?????? ????'',''Print_info'',MB_OK);



谢谢

Hi, I am trying to show a message box item as "اردو ویکیپیڈیا", this is a unicode character; I am using Delphi 7; but in the editor it is showing as ????? ?????, it is not supporting unicode;

Can any one tell me what I need to do in the Delphi editor or project to make it unicode compatible?
code"
MessageBoxW(0,''اردو ویکیپیڈی'', ''Print_info'',MB_OK);

This is showing as
MessageBoxW(0,''?????? ????'', ''Print_info'',MB_OK);

Thanks

推荐答案

我会告诉你一个悲伤的故事,但确实存在一些解决方案。



不幸的是,这个版本的Delphi对Unicode的支持有限.Borland VCL根本不支持Unicode,所以,使用你使用的控件,你根本不能做任何事情。你会需要一些自定义控件来取代VCL。



2005年,我找到了一种相对平滑的方法来派生VCL控件来添加Unicode支持。我虽然完全重写VCL会是不可行,即使有任何其他方式从德尔福社区材料中可以看出,这是不可能的。我找到了一个棘手的方法:我从VCL控件继承了选择控件并开发了一个基于Windows API的技巧:动态重新注册窗口类,添加Unicode支持并保留其他所有内容。这是你可以使用的想法。



我在印刷的 The Delphi Magazine 上发表了这项工作:

SA Kryukov,'Unicode控制:VCL能做什么?',德尔福杂志,116(2005年4月),p。 33-43



很遗憾,不久之后这本杂志就关闭了。我自己并不是这本杂志的订阅者。在编辑证明之前,我没有硬拷贝,只有我原创作品的副本。随着时间的推移,对代码的在线访问被删除了,但我已经拥有了。我以前在网上看到这项工作代码的一些(非法)副本。就个人而言,我不介意是否有人使用它。而且我没有动力重新打印它(即使假设它在法律上也很合适),因为那个版本的VCL已经过时了。



那么,什么我可以建议吗?



首先,您可以使用更高版本的Delphi,从Embarcadero Delphi 2009(Delphi 12,代号为Tiburón)开始。这是在首次引入对VCL的完全Unicode支持时: http://en.wikipedia.org/wiki/Embarcadero_Delphi [ ^ ]。



另一个好的选择是切换到开源Free Pascal:

http:// en .wikipedia.org / wiki / Free_Pascal [ ^ ] ,

http://www.freepascal.org/ [ ^ ]。



Free Pascal的一大好处是它是真正的多平台。它具有Delphi兼容模式。当然支持Unicode。



-SA
I''ll tell you the sad story, but some solutions do exist.

Unfortunately, this version of Delphi had limited support of Unicode. Borland VCL was not Unicode-enabled at all, so, with the controls you are using, you cannot do anything at all. You would need some custom controls replacing VCL.

In 2005, I found a relatively smooth way to derive VCL controls to add Unicode support. I though that rewriting the VCL completely would be infeasible, even though any other way though to be impossible, as far as I could see from Delphi community material. I found a tricky way: I inherited select controls from VCL controls and develop a trick based on Windows API: re-registering of the window class on the fly, adding Unicode support and keeping everything else. This is the idea you could use.

I published this work in the printed The Delphi Magazine:
S. A. Kryukov, ‘Unicode Controls: What Can VCL Do?’, The Delphi Magazine, 116 (April 2005), p. 33-43

Unfortunately, pretty soon after that this magazine was closed. I wasn''t a subscriber of this magazine myself. I don''t have a hard copy, only a copy of my original work, before editor''s proof. The on-line access to the code was removed with time, but I have it. I used to see some (illegal) copies of the code of this work on the Web. Personally, I would not mind if anyone uses it. And I have a very little incentive to re-print it (even assuming it would be legally fine), as that version of VCL is quite obsolete.

So, what else can I advise?

First of all, you can use later version of Delp starting from Embarcadero Delphi 2009 (Delphi 12, code named Tiburón). This is when full Unicode support for VCL was first introduced: http://en.wikipedia.org/wiki/Embarcadero_Delphi[^].

Another good option would be switching to open-source Free Pascal:
http://en.wikipedia.org/wiki/Free_Pascal[^],
http://www.freepascal.org/[^].

One great benefit of Free Pascal is that it is truly multi-platform. And it has Delphi compatibility mode. Unicode is of course supported.

—SA


在你的情况下,最简单的是创建字符串的UTF8表示,写入ConvertUTF8ToUTF16函数或查找现有函数,然后调用MessageBoxW(0,ConvertUTF8ToUTF16(''yourUTF8Constant''),...)。这样你就可以处理非Unicode Delphi中的任何Unicode文本。



编辑:似乎很多人都不懂简单的快捷方式。 ''yourUTF8Constant''文字值可以在unicode文本编辑器中创建,保存为UTF8编码的文本文件,并从文件中加载(或者您可以将文件存储为资源)或者只是复制到源代码中(但在后一种情况下,您需要检查文本是否正确显示,并且在系统上打开源代码且其他代码页处于活动状态时不会损坏文本。



UTF8通常是一种更灵活,更通用的方式来处理非unicode环境中的unicode。例如,在不是Unicode的PHP中,我描述的方法一直用于使用Unicode。



当将Unicode字符串传递给期望Unicode的系统函数时,您需要将UTF8转换为UTF16。您可以在ElPack或TNT库中获取转换函数或编写自己的函数。
In your case the simplest would be to create UTF8 representation of your string, write ConvertUTF8ToUTF16 function or find an existing one and then call MessageBoxW(0, ConvertUTF8ToUTF16(''yourUTF8Constant''), ... ). This way you can deal with any Unicode text in non-Unicode Delphi.

seems that many people don''t understand simple shortcuts. The ''yourUTF8Constant'' literal value can be created in a unicode text editor, saved to UTF8-encoded text file and either loaded from the file (or you can store the file as a resource) or just be copied to your source code (but in the latter case you need to check that the text is displayed properly and is not spoiled when the source code is opened on the system with another code page being active).

UTF8 is in general a more flexible and universal way to deal with unicode in non-unicode environments. For example, in PHP which is not Unicode the approach I described is used all the time to work with Unicode.

Of course you need to convert UTF8 to UTF16 when passing Unicode strings to system functions that expect Unicode. You can take conversion functions in ElPack or in TNT library or write your own function.


这篇关于'اردوویکیپیڈیا'显示'? ?在delphi编辑器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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