Scintilla 支持 Unicode 吗? SCI_GETCHARAT 怎么样?

发布于 2024-11-11 07:57:20 字数 188 浏览 6 评论 0原文

Scintilla 真的支持 Unicode 吗?如果是这样,为什么 SCI_GETCHARAT 返回 char 值(转换为LRESULT)?

Does Scintilla really support Unicode? If so, why does SCI_GETCHARAT return a char value (casted to LRESULT)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情域 2024-11-18 07:57:20

来自 SCI_SETCODEPAGE 文档...

代码页 SC_CP_UTF8 (65001) 将 Scintilla 设置为 Unicode 模式,并将文档视为以 UTF-8 表示的字符序列。文本在由操作系统绘制之前会转换为平台的正常 Unicode 编码,因此可以显示希伯来语、阿拉伯语、西里尔语和汉字字符。

您必须检查使用 SCI_GETCHARAT(pos) 检索的字节,并且根据该字节的最高位,可能需要读取 SCI_GETCHARAT(pos+1) 及其他字节才能获取 Unicode 代码点。 (请参阅此处。)

编辑:

对于某些 C++执行此操作的代码,请参见下面(搜索 SciMoz::GetWCharAt):

http://vacuproj.googlecode.com/svn/trunk/npscimoz/npscimoz/oldsrc/trunk.nsSciMoz.cxx

From the SCI_SETCODEPAGE docs...

Code page SC_CP_UTF8 (65001) sets Scintilla into Unicode mode with the document treated as a sequence of characters expressed in UTF-8. The text is converted to the platform's normal Unicode encoding before being drawn by the OS and thus can display Hebrew, Arabic, Cyrillic, and Han characters.

You will have to examine the byte you retrieve with SCI_GETCHARAT(pos) and, depending on the top bits of that, maybe read SCI_GETCHARAT(pos+1) and beyond in order to get the Unicode code point. (See here.)

Edit:

For some C++ code that does this, see below (search for SciMoz::GetWCharAt):

http://vacuproj.googlecode.com/svn/trunk/npscimoz/npscimoz/oldsrc/trunk.nsSciMoz.cxx

他是夢罘是命 2024-11-18 07:57:20

我是很久以前的事了,但如果我没记错的话,Scintilla 并不是一个原生的 Unicode 应用程序。但它仍然有一些 Unicode 支持。

首先,函数名称应该是 SCI_GETBYTEAT,因为它从 UTF-8 内部缓冲区返回一个字节。

此外,该应用程序对键盘有 Unicode 支持,因此它有一些 Unicode 支持:)

I was long time ago but if I remember well Scintilla is not a native Unicode application. Still it has some Unicode support.

First, the function name should SCI_GETBYTEAT, because it returns a byte from UTF-8 internal buffer.

Also, the application has Unicode support for keybaord, so it has some Unicode support :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文