命令组合键的 Unicode 代码点

发布于 2024-09-28 19:31:13 字数 505 浏览 0 评论 0原文

有人可以告诉我如何确定包含“command”键的多键组合的unicode字符点吗?例如,如果用户同时按下键盘上的“command”键和“1”键,那么unicode字符表示是什么?

也许我正在搜索错误的东西,但我无法在字符映射表、键盘引用或 unicode 表 我找到了。我可以整理其他组合键(例如shift-1),因为有明显的字符输出“!”我可以查到它是U+0021。当我进入字符映射表或应用程序时,命令键似乎总是执行操作,而不是将字符结果输出到屏幕。

我的应用程序适用于 iOS,我希望它在 unicode 代码点方面与 Mac OS X 相同。所有提供键盘访问的 iOS API 都将其视为 Unicode 字符源。这就是我尝试以这种方式检测击键的原因。

谢谢。

Can someone please tell me how to determine the unicode character point of a multi-key combination that includes the "command" key? For example, if a user presses the "command" key and "1" key on the keyboard at the same time, what is the unicode character representation for that?

Maybe I'm searching on the wrong thing, but I am not able to locate this in the character maps, keyboard references, or unicode tables I find. I can sort out other key combinations (e.g. shift-1) as there is an obvious character output of "!" that I can look up and find that it is U+0021. When I go to character maps or applications the command key always seems to take an action rather than output a character result to screen.

My app is for iOS, which I would expect to be the same as Mac OS X in terms of the unicode code point. All of the iOS APIs that provide access to the keyboard see it as a source of Unicode characters. Thus the reason I am trying to detect keystrokes this way.

Thanks.

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

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

发布评论

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

评论(3

兮颜 2024-10-05 19:31:13

键盘代码基本上独立于字符代码。

虽然(正如您提到的)许多键都有到标准 ASCII 代码的标准映射,但由应用程序决定如何处理它们。

一些输入API可能在特定操作系统上广泛使用,并且一些应用程序(例如,终端仿真器)可以用作一类任务的公共输入方法,但是没有通用标准。

Unicode 输入的强制性维基百科链接。

Keyboard codes are basically independent of character codes.

While (as you mention) many keys have standard mappings to standard ASCII codes, it is up to the application to decide what to do with them.

Some input API's may be widely used on a particular OS, and some applications (e.g., terminal emulators) may be used as a common input method for a class of tasks, but there is no universal standard.

Obligatory wikipedia link for Unicode input.

半﹌身腐败 2024-10-05 19:31:13

你不能。根本不存在与 Command + 其他字符相对应的 Unicode 代码点。

顺便说一下,Shift 也是如此。您的计算机恰好将某些组合映射到某些 Unicode 代码点这一事实并不意味着 Unicode 指定了此类映射,或者每个键组合都存在映射,或者这些映射对于其他所有人都相同。我每天使用两个键盘;其中一个将 Shift+3 映射到 #,另一个将其映射到 £。这是由操作系统决定的,而不是由 Unicode 决定的。如果您尝试通过监听 # 来检测 Shift+3 按键,那么在我看来,您的程序有一半的时间会被破坏。

这是 XY 问题的完美示例。您并不真正关心 Unicode - 您真正想知道的是如何在 iOS 上使用 Command 修饰符检测按键。您应该问如何做到这一点!可能有一个 API 可以完全满足您的需要,但您只是错过了,因为您专注于解决方案将涉及 Unicode 的假设 - 并且可能有许多 iOS 专家根本没有费心去阅读这个问题,因为他们认为你的问题与 Unicode 而不是 iOS 相关。

You can't. There simply are no Unicode codepoints that correspond to Command + some-other-character.

The same is true of Shift, by the way. The fact that your computer happens to map certain combinations to certain Unicode codepoints does not imply that Unicode specifies such mappings, or that mappings exist for every combination of keys, or that those mappings are the same for everyone else. I use two keyboards every day; one of them maps Shift+3 to #, the other maps it to £. This is decided by the operating system, not by Unicode. If you tried to detect a Shift+3 keypress by listening for #, your program would seem to me to be broken half the time.

This is a perfect example of an XY question. You don't really care about Unicode -- what you really want to know is how to detect keypresses with the Command modifier on iOS. You should just have asked how to do that! There is probably an API that does exactly what you need that you have simply missed, because you were concentrating on your assumption that the solution would involve Unicode -- and there are probably numerous iOS experts who have not bothered to read this question at all, because they thought your problem related to Unicode rather than iOS.

烧了回忆取暖 2024-10-05 19:31:13

简单的回答:不。

您还没有告诉我们您使用的是哪种类型的计算机。将按键映射到 Unicode 代码点是特定于操作系统的,然后取决于活动的区域设置。

Simple answer: no.

You haven't told us what sort of computer you are using. Mapping a key press to a Unicode code point is operating system specific, and then it depends on the locale that is active.

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