How sorts accented characters?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 33
- Joined: Tue Apr 17, 2012 9:50 am
How sorts accented characters?
Hello,
I would like sort a field with accented characters.
sort lines of fld "xx" ascending work but all accented letters are on the end
a
è
e
é
p
result :
a
e
p
é
è
and i would
a
e
é
è
p
Thanks for yours help
I would like sort a field with accented characters.
sort lines of fld "xx" ascending work but all accented letters are on the end
a
è
e
é
p
result :
a
e
p
é
è
and i would
a
e
é
è
p
Thanks for yours help
-
- Posts: 49
- Joined: Sat Jun 16, 2012 7:57 pm
Re: How sorts accented characters?
Salut,
The Dictionary is not really clear on this point, but it seems you can use an international sortType:
HTH
The Dictionary is not really clear on this point, but it seems you can use an international sortType:
Not tested.Dictionary wrote:The sort international form is like sort text, except that it sorts accented characters together with their unaccented counterparts. For example, "" sorts between "e" and "f", rather than at the end of the alphabet as it would using the sort text form.
HTH
Best regards,
Didier
Didier
Re: How sorts accented characters?
Salut,
This script work, but i,m sur there is a simplest way
Best regards
Jean-Marc
This script work, but i,m sur there is a simplest way
Code: Select all
on debSortFieldWithAccent
put fld 1 into t
put t into t2
put "éèêàâä" into tLesC
put "eeeaaa" into tLesC2
repeat for each char tChar in tLesC
put char offset(tChar,tLesC) of tLesC2 into tNewc
replace tChar with tNewc in t2
end repeat
put the num of lines of t into nbl
repeat with i = 1 to nbl
put line i of t into tChar
put "," & line i of t2 after line i of t
wait 1 milliseconds
end repeat
sort lines of t by item 2 of each
repeat with z= 1 to nbl
delete item 2 of line z of t
wait 1 milliseconds
end repeat
put t
end debSortFieldWithAccent
Jean-Marc
https://alternatic.ch
-
- Posts: 49
- Joined: Sat Jun 16, 2012 7:57 pm
Re: How sorts accented characters?
If you don't mind getting the accented chars before standard ones,
works. Here's the result of a quick test:
à
assembler
édifice
effeuiller
fontaine
hérétique
Hérisson
herse
If it doesn't suits you, you'll have to manage your own script, as Jean-Marc suggested.
Code: Select all
sort lines of fld 1 international
à
assembler
édifice
effeuiller
fontaine
hérétique
Hérisson
herse
If it doesn't suits you, you'll have to manage your own script, as Jean-Marc suggested.
Best regards,
Didier
Didier
-
- Livecode Opensource Backer
- Posts: 33
- Joined: Tue Apr 17, 2012 9:50 am
Re: How sorts accented characters?
Hi and Thank you
Sort the field international work and using descending or ascending work again.
Thank you Jean Marc for your code, maybe i use it into and other need.
Warms regards
Sort the field international work and using descending or ascending work again.
Thank you Jean Marc for your code, maybe i use it into and other need.
Warms regards
Re: How sorts accented characters?
Yes,
It seem more simple
Best regards
Jean-Marc
It seem more simple

Best regards
Jean-Marc
https://alternatic.ch
Re: How sorts accented characters?
As I read previous messages in this thread it should work. Was something changed in LC 5.5.4 or I missed something in code:
doesn't work properly. It's behaviour is the same as without "international" sortType.
Marek
Code: Select all
sort lines of fld "names" international
Marek
Re: How sorts accented characters?
Anybody could help me with this problem?
Marek
Marek
Re: How sorts accented characters?
Hi Marek,
could you post a stack or a list of accented words you would like to have sorted?
It would be easier to help you.
In my testing international sort works for a lot of accented characters pre and post 5.5.4
Kind regards
Bernd
could you post a stack or a list of accented words you would like to have sorted?
It would be easier to help you.
In my testing international sort works for a lot of accented characters pre and post 5.5.4
Kind regards
Bernd
Re: How sorts accented characters?
Hi Bernd,
Thanks a lot for reply. Zipped stack file attached.
After proper sort names starting with "Łukasz" should go after names "Ludwik".
Button "Sort" is working as sort / unsort.
Marek
Thanks a lot for reply. Zipped stack file attached.
After proper sort names starting with "Łukasz" should go after names "Ludwik".
Button "Sort" is working as sort / unsort.
Marek
- Attachments
-
- nmSortTest.livecode.zip
- (3.49 KiB) Downloaded 315 times
Re: How sorts accented characters?
Hi Marek,
I see the same you are seeing.
I don't know why it does what it does, but it does it for all versions of Livecode I tested.
I think that sort international refers to the high ASCII values (greater 127 up to 255). The sort works on the ascii values of characters. If you use "international" then the higher ascii values of e.g. é is correctly sorted after e.
But Ł seems to be outside of the ASCII range (the html value is Ł) This is probably why it fails to sort.
I hope someone who knows more about Unicode will jump in.
Sorry to be of no help.
Kind regards
Bernd
I see the same you are seeing.
I don't know why it does what it does, but it does it for all versions of Livecode I tested.
I think that sort international refers to the high ASCII values (greater 127 up to 255). The sort works on the ascii values of characters. If you use "international" then the higher ascii values of e.g. é is correctly sorted after e.
But Ł seems to be outside of the ASCII range (the html value is Ł) This is probably why it fails to sort.
I hope someone who knows more about Unicode will jump in.
Sorry to be of no help.
Kind regards
Bernd
Re: How sorts accented characters?
Thanks a lot Bernd for explanation, I was worry that reason of problems with unicode sorting is like you described.
Marek
Marek
-
- Posts: 1
- Joined: Sat Mar 02, 2013 9:29 am
Re: How sorts accented characters?
Could this be done with a shell command? I assume UNIX can handle sorting unicode characters.