AutoHotkey Community

It is currently May 26th, 2012, 10:55 pm

All times are UTC [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 237 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 16  Next
Author Message
 Post subject:
PostPosted: October 30th, 2009, 6:51 am 
Offline

Joined: November 30th, 2008, 1:51 pm
Posts: 73
@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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 30th, 2009, 11:28 am 
awesome! please keep up the good work!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 30th, 2009, 2:18 pm 
very good news! I will have a try! :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 30th, 2009, 4:14 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Somehow it doesn't work here. I tried msgbox & guiadd, text without any luck. Am I missing something ?

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 30th, 2009, 4:54 pm 
Offline

Joined: November 30th, 2008, 1:51 pm
Posts: 73
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 30th, 2009, 6:42 pm 
The sendinput function doesn't support Unicode characters, such as Chinese characters.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 30th, 2009, 11:31 pm 
Offline

Joined: December 29th, 2007, 9:40 pm
Posts: 142
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...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2009, 12:56 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2009, 3:09 am 
@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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2009, 4:53 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2009, 9:57 am 
Offline

Joined: November 30th, 2008, 1:51 pm
Posts: 73
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2009, 11:31 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Looks like AutoHotkey window does not support unicode characters as well. (KeyHistory, ListVars, ListHotkeys, ListLines)
Can this be adapted?

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Petru
PostPosted: October 31st, 2009, 12:38 pm 
Offline

Joined: December 17th, 2007, 6:39 pm
Posts: 235
Location: Galati, Romania
I'm afraid it doesn't support #includes. It says that the files are not found.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Petru
PostPosted: October 31st, 2009, 12:58 pm 
Offline

Joined: November 30th, 2008, 1:51 pm
Posts: 73
@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 October 31st, 2009, 9:00 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Petru
PostPosted: October 31st, 2009, 1:31 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
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

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 237 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 16  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Yahoo [Bot] and 13 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group