Jump to content

Why CharW() > 64967 compares as an empty string?


Recommended Posts

CharW() >= 64968 compares with "" as True. I think it shouldn't. What's wrong there?

Thanks

For $i = 64960 To 64975
        ConsoleWrite('chrw(' & $i & ') = "" ? --> ' & (ChrW($i) = '') & @TAB & @error & @CRLF)
    Next

results in

chrw(64960) = "" ? --> False    0
chrw(64961) = "" ? --> False    0
chrw(64962) = "" ? --> False    0
chrw(64963) = "" ? --> False    0
chrw(64964) = "" ? --> False    0
chrw(64965) = "" ? --> False    0
chrw(64966) = "" ? --> False    0
chrw(64967) = "" ? --> False    0
chrw(64968) = "" ? --> True     0
chrw(64969) = "" ? --> True     0
chrw(64970) = "" ? --> True     0
chrw(64971) = "" ? --> True     0
chrw(64972) = "" ? --> True     0
chrw(64973) = "" ? --> True     0
chrw(64974) = "" ? --> True     0
chrw(64975) = "" ? --> True     0

 

Edited by Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to post
Share on other sites

The Unicode range uFB50 to uFDFF is the Arabic Presentation Form A block.

UFCB0 to UFCBF displays as "ﲰﲱﲲﲳﲴﲵﲶﲷﲸﲹﲺﲻﲼﲽﲾﲿ" (remember arabic writes rigth to left).  There are a number of unassigned codepoints in this block, namely : uFD40 to uFD4F, uFD90 to uFD91, uFDC8 to uFDEF, uFDFE to uFDFF.  All of the assigned codepoints in the block range are arabic ligatures having category Lo (letter other), except uFDFC which is the RIAL SIGN currency symbol, category Sc (Symbol currency).

No codepoint should compare to the empty string: a codepoint is a codepoint and can't never be equal to "no codepoint", ever.  That a codepoint is currently unassigned in today's Unicode version doesn't preclude it being meaningful in the future.  And valid codepoints in a string have no right to disappear nor hide themselves from scrutiny.

But there is a catch here: AutoIt = comparison is case-insensitive.  If you replace the test with the case-sensitive == you get a different, correct result.

I don't know how = is coded internally but yes, there is a bug here.  Please file a ticket.  Here's how to list failing (UCS2) codepoints:

For $i = 0 To 0xFFFF
    If ChrW($i) = '' Then _
        ConsoleWrite(ChrW($i) & @TAB & 'Chrw(0x' & Hex($i, 4) & ') = "" ? --> ' & (ChrW($i) = '') & @TAB & @LF)
Next

 

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to post
Share on other sites

Hi, @jchd thanks for the explanation.

9 hours ago, jchd said:

 If you replace the test with the case-sensitive == you get a different, correct result.

I will use == then.

9 hours ago, jchd said:

Please file a ticket.

Done here: https://www.autoitscript.com/trac/autoit/ticket/3790#ticket

Thanks again for your help.

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...