Sorting Unicode chars not quite right

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Sorting Unicode chars not quite right

Post by kaveh1000 » Sun Oct 20, 2019 8:00 pm

I have a set of 35 non-ascii characters. When I sort them in BBEdit on Mac, I get what seems to be the correct order, namely:

Code: Select all

á
à
â
ä
ã
æ
ć
č
é
è
ê
ě
ë
í
ì
ĭ
î
ï
ń
ó
ò
ô
ö
ø
ř
Ś
š
ú
ù
û
ü
ý
ỳ
ŷ
ž
but in LiveCode, using

Code: Select all

sort tText
the result is

Code: Select all

ý
á
à
â
ä
ã
é
è
ê
ë
í
ì
î
ï
ó
ò
ô
ö
ú
ù
û
ü
æ
ø
ć
č
ě
ĭ
ń
ř
Ś
š
ŷ
ž
ỳ
Any ideas please?
Kaveh

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Sorting Unicode chars not quite right

Post by Klaus » Sun Oct 20, 2019 8:25 pm

I get the same as you in BBedit when I use:
...
sort fld 1 international
...
macOS 10.14.6, LC 9.5

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Sorting Unicode chars not quite right

Post by kaveh1000 » Sun Oct 20, 2019 8:31 pm

Oh I did not know about sort international. It works! Thank you so much Klaus, as ever.

Regards
Kaveh
Kaveh

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Sorting Unicode chars not quite right

Post by FourthWorld » Sun Oct 20, 2019 8:38 pm

This came up on the use-livecode discussion list last month. Mark Waddingham noted that the bug is limited to sorting Unicode characters in a variable, but works well in a field. He also offered a workaround for sorting vars:

http://lists.runrev.com/pipermail/use-l ... 56110.html
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Sorting Unicode chars not quite right

Post by Klaus » Sun Oct 20, 2019 8:48 pm

kaveh1000 wrote:
Sun Oct 20, 2019 8:31 pm
Oh I did not know about sort international
Hard to believe, but I ALWAYS read up the complete entry in the dictionary
if a keyword or command does not behave as I (sic!) exspected! 8)

Well, and sometimes also just for fun.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Sorting Unicode chars not quite right

Post by FourthWorld » Sun Oct 20, 2019 9:10 pm

Klaus wrote:
Sun Oct 20, 2019 8:48 pm
kaveh1000 wrote:
Sun Oct 20, 2019 8:31 pm
Oh I did not know about sort international
Hard to believe, but I ALWAYS read up the complete entry in the dictionary
if a keyword or command does not behave as I (sic!) exspected! 8)

Well, and sometimes also just for fun.
I used to when the formatting was legible. After moving it from the robust LC format to the web we still have a lot of entries that could use more line breaks.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Sorting Unicode chars not quite right

Post by kaveh1000 » Sun Oct 20, 2019 9:37 pm

At least I know it was not a silly error on my part! And yes, I did try the field Richard and noticed it was different, but I forgot about it after trying a few other things!
Kaveh

Post Reply

Return to “Talking LiveCode”