|
|
What would it take to include Unicode Support? I've found this library to be tremendously helpful, but I've run into a problem with non-ASCII characters. Thanks for your work on this.
|
|
Coordinator
Jun 7, 2010 at 12:17 AM
|
Hi,
Can you give me any more details?
From memory, if you are calling the SimulateTextInput() method, it should automatically recognise that a unicode character (non-ascii) has been specified and set the UNICODE flag. The reality is that I didn't have a good test case at the time.
If you can send me through the sample code file/project, I can help you from there.
Cheers,
Mike
On Thu, Jun 3, 2010 at 11:53 PM, byudaniel <notifications@codeplex.com> wrote:
From: byudaniel
What would it take to include Unicode Support? I've found this library to be tremendously helpful, but I've run into a problem with non-ASCII characters. Thanks for your work on this.
|
|
|
|
Here is a quick example: (Form with textBox1 and a button that will focus the textbox and simulate text entry into this field.)
private void button1_Click(object sender, RoutedEventArgs e)
{
textBox1.Focus();
InputSimulator.SimulateTextEntry("Muḩāfaz̧at Shamāl Sīnā'");
}
The text that is entered into the field shows up as Mu??faz?at Sham?l S?n?'
|
|
|
|
I downloaded the latest source instead of the binary and it now works great!
|
|
Coordinator
Jun 7, 2010 at 1:45 AM
|
Thanks, I'll have a bit of a play...
Mike
On Mon, Jun 7, 2010 at 11:38 AM, byudaniel <notifications@codeplex.com> wrote:
From: byudaniel
Here is a quick example: (Form with textBox1 and a button that will focus the textbox and simulate text entry into this field.)
private void button1_Click(object sender, RoutedEventArgs e)
{
textBox1.Focus();
InputSimulator.SimulateTextEntry("Muḩāfaz̧at Shamāl Sīnā'");
}
The text that is entered into the field shows up as Mu??faz?at Sham?l S?n?'
|
|
|
|
I also had trouble getting Unicode characters to work using SimulateTextEntry. I made the following two modifications to InputSimulator::SimulateTextEntry, and then it worked:
//DBC: Adding support for Unicode.
//var chars = UTF8Encoding.ASCII.GetBytes(text);
var chars = UTF8Encoding.Unicode.GetBytes(text);
var len = chars.Length;
INPUT[] inputList = new INPUT[len * 2];
for (int x = 0; x < len; x+=2)
{
//DBC: Adding support for Unicode.
//UInt16 scanCode = chars[x];
UInt16 scanCode = BitConverter.ToUInt16(chars, x);
Thanks for a very useful class!
David Cater
|
|
Coordinator
Nov 8, 2010 at 2:14 AM
|
Hi David,
Thanks for posting the fix. I'm working on an updated version that *should* handle some more of the cases not covered by the original code-base. I didn't have a good test case for Unicode or other character support. This could fix several issues.
I'll incorporate it into the WIP codebase and should be releasing soon.
Cheers,
Mike
On Mon, Nov 8, 2010 at 10:17 AM, xiard <notifications@codeplex.com> wrote:
From: xiard
I also had trouble getting Unicode characters to work using SimulateTextEntry. I made the following two modifications to InputSimulator::SimulateTextEntry, and then it worked:
//DBC: Adding support for Unicode.
//var chars = UTF8Encoding.ASCII.GetBytes(text);
var chars = UTF8Encoding.Unicode.GetBytes(text);
var len = chars.Length;
INPUT[] inputList = new INPUT[len * 2];
for (int x = 0; x < len; x+=2)
{
//DBC: Adding support for Unicode.
//UInt16 scanCode = chars[x];
UInt16 scanCode = BitConverter.ToUInt16(chars, x);
Thanks for a very useful class!
David Cater
|
|