AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

UNICODE version of AutoHotkey
Goto page Previous  1, 2, 3, ... 14, 15, 16  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
jackieku



Joined: 30 Nov 2008
Posts: 69

PostPosted: Fri Oct 30, 2009 6:51 am    Post subject: Reply with quote

@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
View user's profile Send private message
neh neh pork
Guest





PostPosted: Fri Oct 30, 2009 11:28 am    Post subject: Reply with quote

awesome! please keep up the good work!
Back to top
Guest






PostPosted: Fri Oct 30, 2009 2:18 pm    Post subject: Reply with quote

very good news! I will have a try! Very Happy
Back to top
majkinetor



Joined: 24 May 2006
Posts: 4116
Location: Belgrade

PostPosted: Fri Oct 30, 2009 4:14 pm    Post subject: Reply with quote

Somehow it doesn't work here. I tried msgbox & guiadd, text without any luck. Am I missing something ?
_________________
Back to top
View user's profile Send private message
jackieku



Joined: 30 Nov 2008
Posts: 69

PostPosted: Fri Oct 30, 2009 4:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
Guest






PostPosted: Fri Oct 30, 2009 6:42 pm    Post subject: Reply with quote

The sendinput function doesn't support Unicode characters, such as Chinese characters.
Back to top
TodWulff



Joined: 29 Dec 2007
Posts: 116

PostPosted: Fri Oct 30, 2009 11:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2224

PostPosted: Sat Oct 31, 2009 12:56 am    Post subject: Reply with quote

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
View user's profile Send private message
Guest






PostPosted: Sat Oct 31, 2009 3:09 am    Post subject: Reply with quote

@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
Code:
#encoding utf-8

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

PostPosted: Sat Oct 31, 2009 4:53 am    Post subject: Reply with quote

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
View user's profile Send private message
jackieku



Joined: 30 Nov 2008
Posts: 69

PostPosted: Sat Oct 31, 2009 9:57 am    Post subject: Reply with quote

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
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 2198
Location: GERMANY

PostPosted: Sat Oct 31, 2009 11:31 am    Post subject: Reply with quote

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) Wink
Back to top
View user's profile Send private message
Petru



Joined: 17 Dec 2007
Posts: 139
Location: Galati, Romania

PostPosted: Sat Oct 31, 2009 12:38 pm    Post subject: Petru Reply with quote

I'm afraid it doesn't support #includes. It says that the files are not found.
Back to top
View user's profile Send private message Yahoo Messenger
jackieku



Joined: 30 Nov 2008
Posts: 69

PostPosted: Sat Oct 31, 2009 12:58 pm    Post subject: Re: Petru Reply with quote

@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
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 2198
Location: GERMANY

PostPosted: Sat Oct 31, 2009 1:31 pm    Post subject: Re: Petru Reply with quote

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 Confused
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) Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, ... 14, 15, 16  Next
Page 2 of 16

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group