View Full Version : A little more information about hte practicalities of Unicode.
Michael Mullan
1-Oct-2020, 01:35 PM
https://boyter.org/posts/unicode-support-what-does-that-actually-mean/
is a pleasant enough read, had some useful information.
Interesting..
So I wrote a very difficult program in DF20 and can you guess what the output is?
Use Windows.pkg
Procedure CompareTest
String sString1
String sString2
// ſecret == secret == Secret
Move "ſecret" to sString1
Move "Secret" to sString2
If (Lowercase(sString1)=Lowercase(sString2)) Begin
Showln "PASS"
End
Else Begin
Showln "FAIL"
End
inkey windowindex
End_Procedure
Send CompareTest
;)
--
Wil
Samuel Pizarro
1-Oct-2020, 06:25 PM
His article was good, but he did not mention that all of those nuances are managed by the COLLATING algorithm ...
If case matters,
if accented mattes,
if ...
if ...
yes, there are a LOT of ifs...
If you want those "special" chars to be considered the same. you have to tell it to do so... and now DF can do it.. (oh my God, )
Try this one now..
Procedure CompareTest2
String sString1
String sString2
Set_Attribute DF_LOCALE_CODE to "en_US@colStrength=primary"
// ſecret == secret == Secret
Move "ſecret" to sString1
Move "Secret" to sString2
If (sString1 = sString2) Begin
Showln "PASS"
End
Else Begin
Showln "FAIL"
End
End_Procedure
Send CompareTest2
inkey windowindex
:rolleyes:
And notice that I dont even need to use lowercase function anymore..
Cheers
Samuel Pizarro
1-Oct-2020, 06:31 PM
Ah.. forgot to get even further....
Procedure CompareTest2
String sString1
String sString2
String sString3
Set_Attribute DF_LOCALE_CODE to "en_US@colStrength=primary"
// ſecret == secret == Secret
Move "ſecret" to sString1
Move "Secret" to sString2
Move "secret" to sString3
If ((sString1 = sString2) and (sString1 = sString3) and (sString2 = sString3)) Begin
Showln "PASS"
End
Else Begin
Showln "FAIL"
End
End_Procedure
Send CompareTest2
inkey windowindex
Thanks Samuel,
I was wondering about that, but too much other stuff (not DataFlex) going on down here at that moment to research in detail.
For others wondering about DF_LOCALE_CODE, see this post: https://support.dataaccess.com/Forums/showthread.php?65401-Congratulations-about-ICU-addoption-request-to-not-stop-there!&p=351649#post351649
--
Wil
Powered by vBulletin® Version 4.2.5 Copyright © 2021 vBulletin Solutions Inc. All rights reserved.