如何将X11 KeySym映射到Unicode字符? [英] How to map a X11 KeySym to a Unicode character?

查看:232
本文介绍了如何将X11 KeySym映射到Unicode字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是此文件的精确副本问题;但是,已接受的答案中链接的代码已有将近11年的历史了,代码中的此注释导致我提出了重复的问题:

This is an exact duplicate of this question; however the code linked in the accepted answer is nearly 11 years old, and this comment in the code leads to my duplicate question:

keysym-> UTF-8转换将有望由 通过XmbLookupString()的Xlib,理想情况下不必在X中完成 应用程序.但是我们还没有.

The keysym -> UTF-8 conversion will hopefully one day be provided by Xlib via XmbLookupString() and should ideally not have to be done in X applications. But we are not there yet.

我们到了吗?我知道XwcLookupString,但是类似...

Are we there yet? I'm aware of XwcLookupString, but something like...

wchar_t unicode = XKeySymToWideChar( keysym );

...将更加简单和逻辑,并且每次添加或更改KeySyms时都不需要更新.

... would be much simpler and logical, and not require updating whenever KeySyms are added or changed.

X11/Xlib中是否有一个简单的函数可以将KeySym映射到它的Unicode等效项?

Is there a simple function in X11/Xlib that will map a KeySym to its Unicode equivalent?

推荐答案

X11/Xlib中是否存在一个简单的函数,该函数会将KeySym映射到其 等价于Unicode?

Is there a simple function in X11/Xlib that will map a KeySym to its Unicode equivalent?

肯定的答案是

因为Unicode是Xlib发明的多年,所以没有人去过 回去添加这样的东西?大多数Xlib API是代码集 因为它是在每个语言环境都使用 不同的字符集(ISO 8859-*,Big5,JIS等),因此 适用于当前语言环境的char缓冲区.有一些UTF-8 在以后的几年中添加特定的内容,但是大多数情况下,我们一直在尝试让 从那时起,Xlib放心,将新的API设计推向xcb 代替.

Because Unicode was invented years after Xlib and no one ever went back to add such a thing? Most of the Xlib API is codeset independent since it was written in the days when every locale used a different character set (ISO 8859-*, Big5, JIS, etc.), so you get a char buffer appropriate to the current locale. There were a few UTF-8 specific additions in later years, but mostly we've been trying to let Xlib rest in peace since then, pushing new API design towards xcb instead.

这篇关于如何将X11 KeySym映射到Unicode字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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