Java机器人类新闻土耳其语信(Ö,ö,Ş,ş,Ü,ü,Ğ,ğ,İ,ı,Ç,ç,Ə,ə)? [英] Java Robot class press Turkish letter (Ö, ö, Ş, ş, Ü, ü, Ğ, ğ, İ, ı, Ç, ç, Ə, ə)?
问题描述
我有问题的新闻一个特殊的信件(土耳其等)通过java机器人类。我有一个方法,按下键作为alt +键码。我不能将一些特殊字母转换为当前键码。那么我该如何解决呢? Thanx
I have problem with press a special letter (Turkish etc.) via java robot class. I hava a method to press keys which works as alt+keycode. I cant convert some special letters to current keycode. So how can I solve it. Thanx
例如:
KeyStroke ks = KeyStroke.getKeyStroke('ö', 0);
System.out.println(ks.getKeyCode());
Output : 246
// So alt+0246='ö'
//but if I convert 'ş' to keycode
//Output is 351 . So alt+351= '_' and alt+0351= '_'
//What is the Correct combination for 'ş'. same for 'Ş', 'ş','Ğ', 'ğ', 'İ', 'ı', 'Ə', 'ə'
KeyPress:
public void altNumpad(int... numpadCodes) {
if (numpadCodes.length == 0) {
return;
}
robot.keyPress(VK_ALT);
for (int NUMPAD_KEY : numpadCodes) {
robot.keyPress(NUMPAD_KEY);
robot.keyRelease(NUMPAD_KEY);
}
robot.keyRelease(VK_ALT);
}
推荐答案
字符编号Unicode标准。也用于HTML,因此您可以使用此表。
The character numbers are defiunied in the Unicode standard. The are also used in HTML, therefore you can use this table.
无论如何,如果你看到源代码中的字符取决于编辑器正确解释文件的事实(首选UTF-8)。
Anyway if you see the character in the source code depends on the fact that the editor interprets the file correctly (UTF-8 is preferred).
其次,使用的编辑器必须安装包含这些字符的字体。因此,如果你键入alt + 0351和get和'_',这可能只是一个替换字符,表示字体错过了这个字符。
Second the used editor must have a font installed that contains these characters. Hence if you type alt+0351 and get and '_' this may just be a replacement character indicating that the font misses this character.
Java编译器的源代码是UTF-8 - 只是为了确保( javac -encoding utf8
)。
And in the end you should tell the Java compiler that the source code is UTF-8 - just to make sure (javac -encoding utf8
).
这篇关于Java机器人类新闻土耳其语信(Ö,ö,Ş,ş,Ü,ü,Ğ,ğ,İ,ı,Ç,ç,Ə,ə)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!