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 and ascii delimeters, a guide for the perplexed...

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
JoeSchmoe



Joined: 17 Feb 2008
Posts: 303

PostPosted: Sat Aug 22, 2009 8:08 pm    Post subject: unicode and ascii delimeters, a guide for the perplexed... Reply with quote

Hi all,

In a script that I've been working on forever, I need a pair of characters that aren't typically used in strings, to use as delimeters and for marking special substrings. These characters would be used internally by the script to encode various things

My first thought is to use the ASCII BEL, BS, or EOT characters. For example, I might want to do
Code:
(For simplicity, I'm going to represent the BEL character with the string "<BEL>.")
Loop, Parse, LongString, <BEL>

However, these ASCII characters are nonprinting, so they make the code hard to read.

However, I have seen characters with umlauts and accents in AHK code.
Can anyone elighten me on what is going on here. I'd love to be able to choose arbitrary unicode characters, but I've read that AHK doesn't support unicode.

Then I wondered if maybe AHK could use the umlauted characters because it can use ANSI characters (i.e. Windows-1252). I've seen references to ASCII characters in the documentation, but never ANSI ones. Does AHK use ANSI internally?

Any information greatly appreciated. Please go easy on me, because while I've done some research, I don't have much background in this.
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 3254
Location: Simi Valley, CA

PostPosted: Sun Aug 23, 2009 1:27 am    Post subject: Reply with quote

Yes, you can use characters like ñ and Ö as delimiters. AHK apparently uses the ansi code page internally, so any ansi character between 1 and 255 is ok with AHK.
_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!
Back to top
View user's profile Send private message
JoeSchmoe



Joined: 17 Feb 2008
Posts: 303

PostPosted: Sun Aug 23, 2009 3:42 am    Post subject: Reply with quote

Thanks!

I think I've settled on using ¬, «, », and § in my script for now.

So are ANSI encodings deep in AHK in such a way that I can be confident that commands will be pretty robust? Is anyone aware of any limitations involved with using the full set of ANSI characters in AHK? I'd hate to get pretty far into a project only to discover a key limitation that renders the basic design strategy impractical.
Back to top
View user's profile Send private message
YMP



Joined: 23 Dec 2006
Posts: 418
Location: Russia

PostPosted: Sun Aug 23, 2009 8:09 am    Post subject: Reply with quote

I am constantly using the full set, since cyrillic letters are mapped to the upper half of the ANSI codes. One problem with the upper codes is that they may denote different characters in different locales. In my locale, the default codepage is Windows-1251, not 1252, so my ANSI charset does not include, for example, German letters with umlauts because their codes are used for cyrillic characters. However, this is only a representation problem; AutoHotkey actually works not with characters as we see them on the screen but with character codes.
Back to top
View user's profile Send private message
JoeSchmoe



Joined: 17 Feb 2008
Posts: 303

PostPosted: Sun Aug 23, 2009 5:01 pm    Post subject: Reply with quote

Thanks, YMP. That's very helpful to know.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
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