 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
jackieku
Joined: 30 Nov 2008 Posts: 69
|
Posted: Fri Oct 30, 2009 6:51 am Post subject: |
|
|
@Sean
It always puts "a character" at the tail of the buffers, hence it is 2 bytes in this version.
The bugs in NumGet() and NumPut() will be fixed in the next release, thank for your report. However, since AutoHotkey always set the capacity of a variable >= 4 bytes, there are some differences between original version and Unicode version in your examples. Because it attempts to read a "UInt" (4 bytes) from a variable but it set its capacity to 2 (AutoHotkey extends it to 4 bytes internally).
@JimKarvo
I'll add some options to File* to support files in different charsets. |
|
| Back to top |
|
 |
neh neh pork Guest
|
Posted: Fri Oct 30, 2009 11:28 am Post subject: |
|
|
| awesome! please keep up the good work! |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Oct 30, 2009 2:18 pm Post subject: |
|
|
very good news! I will have a try!  |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4116 Location: Belgrade
|
Posted: Fri Oct 30, 2009 4:14 pm Post subject: |
|
|
Somehow it doesn't work here. I tried msgbox & guiadd, text without any luck. Am I missing something ? _________________
 |
|
| Back to top |
|
 |
jackieku
Joined: 30 Nov 2008 Posts: 69
|
Posted: Fri Oct 30, 2009 4:54 pm Post subject: |
|
|
There are some updates, please check them at the first post.
@majkinetor
The script files must be saved with a BOM if your scripts contain the characters outside your system codepage. |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Oct 30, 2009 6:42 pm Post subject: |
|
|
| The sendinput function doesn't support Unicode characters, such as Chinese characters. |
|
| Back to top |
|
 |
TodWulff
Joined: 29 Dec 2007 Posts: 116
|
Posted: Fri Oct 30, 2009 11:31 pm Post subject: |
|
|
| jackieku wrote: | | The script files must be saved with a BOM if your scripts contain the characters outside your system codepage. |
Could you please point to guidance that might explain to those of us new to using unicode how we might accomplish same? TIA.
-t _________________ When replying, please feel free to address me as Tod. My AHK.net site... |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2224
|
Posted: Sat Oct 31, 2009 12:56 am Post subject: |
|
|
| jackieku wrote: | | The script files must be saved with a BOM if your scripts contain the characters outside your system codepage. | How about checking next with IsTextUnicode API when there is no BOM? I suppose it can detect many scripts in UTF-16LE at least. BTW, it seems now have to specify the dll file name, even for kernel32 etc, in DllCall.
| Code: | MsgBox % DllCall("RtlMoveMemory", "UintPtrP", x, "UintPtrP", 1, "UintPtr", 4) "|" ErrorLevel "|" x
MsgBox % DllCall("kernel32\RtlMoveMemory", "UintPtrP", x, "UintPtrP", 1, "UintPtr", 4) "|" ErrorLevel "|" x |
|
|
| Back to top |
|
 |
Guest
|
Posted: Sat Oct 31, 2009 3:09 am Post subject: |
|
|
@Sean
I think UTF-16LE w/o BOM files are used rarely, and only few text editors support to edit them. The files in UTF-8 w/o BOM are used much more, but IsTextUnicode() cannot handle that if I didn't misunderstand the document.
I think something like
might be a preferable solution.
About the DllCall(), I'll take a look around it. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2224
|
Posted: Sat Oct 31, 2009 4:53 am Post subject: |
|
|
| Quote: | | but IsTextUnicode() cannot handle that if I didn't misunderstand the document. | Yes, AFAIK, there exist no (direct) API to check against UTF-8 in Windows. However, I think can utilize (indirectly) MultiByteToWideChar API. The routine would look like
| Code: | If DllCall("advapi32\IsTextUnicode", "Uint", pv, "int", cb, "Uint", 0)
{
...
}
Else If cch := DllCall("kernel32\MultiByteToWideChar", "Uint", 65001, "Uint", MB_ERR_INVALID_CHARS:=8, "Uint", pv, "int", cb, "Uint", 0, "int", 0)
{
...
}
Else If cch := DllCall("kernel32\MultiByteToWideChar", "Uint", 0, "Uint", 8, "Uint", pv, "int", cb, "Uint", 0, "int", 0)
{
...
}
Else
{
Error!
}
|
If it doesn't work I suppose can build a custom routine to detect UTF-8, as that's fairly straightforward for UTF-8, but, the problem is speed. |
|
| Back to top |
|
 |
jackieku
Joined: 30 Nov 2008 Posts: 69
|
Posted: Sat Oct 31, 2009 9:57 am Post subject: |
|
|
| Anonymous wrote: | | The sendinput function doesn't support Unicode characters, such as Chinese characters. |
Because SendInput was intent to send a series of key events (not characters). When we type Chinese characters we need a software called input method engine (IME), but the keyboard is the same with the ones in U.S. (same keymap).
However, I'll try to work on it since the SendInput() Windows API seems to support this case. |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 2198 Location: GERMANY
|
Posted: Sat Oct 31, 2009 11:31 am Post subject: |
|
|
Looks like AutoHotkey window does not support unicode characters as well. (KeyHistory, ListVars, ListHotkeys, ListLines)
Can this be adapted? _________________ AutoHotFile - ToolTip(n,text,title,options) |
|
| Back to top |
|
 |
Petru
Joined: 17 Dec 2007 Posts: 139 Location: Galati, Romania
|
Posted: Sat Oct 31, 2009 12:38 pm Post subject: Petru |
|
|
| I'm afraid it doesn't support #includes. It says that the files are not found. |
|
| Back to top |
|
 |
jackieku
Joined: 30 Nov 2008 Posts: 69
|
Posted: Sat Oct 31, 2009 12:58 pm Post subject: Re: Petru |
|
|
@HotKeyIt
I tested it with the script below. (the string is in Japanese, whereas my system code page is traditional Chinese)
| Code: |
#Persistent
var := "こんにちは"
ListVars
|
It display those characters properly, but I guess it is affected by the font used in that window. Anyway, could you provide a script for me to for testing?
| Petru wrote: | | I'm afraid it doesn't support #includes. It says that the files are not found. |
But it works just fine here, please provide more details. (how to reproduce)
Last edited by jackieku on Sat Oct 31, 2009 9:00 pm; edited 1 time in total |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 2198 Location: GERMANY
|
Posted: Sat Oct 31, 2009 1:31 pm Post subject: Re: Petru |
|
|
| jackieku wrote: | @HotKeyIt
I tested it with the script below. (the string is in Japanese, whereas my system code page is traditional Chinese)
| Code: |
#Persistent
var := "こにちは"
ListVars
|
It display those characters properly, but I guess it is affected by the font used in that window. Anyway, could you provide a script for me to for testing?
| Petru wrote: | | I'm afraid it doesn't support #includes. It says that the files are not found. |
But it works just fine here, please provide more details. (how to reproduce) |
Very odd, on my system, the only program that can display your text is MSWord
So also AutoHotkey Main Window does not display it right.
Must be something system dependant.
| Code: | #Include c:\Temp\Script.ahk ;works
#Include Script.ahk ;does not work
#Include .\Script.ahk ;does not work |
_________________ AutoHotFile - ToolTip(n,text,title,options) |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|