Skip to main content
Released

Improve Sorter to handle accented characters

Related products:FME Form
  • October 29, 2015
  • 9 replies
  • 69 views

fmelizard
Safer
Forum|alt.badge.img+22
improve sorter => consider accented words ! Ex : Zoo, École, Auto FME sorter ASC : Auto, Zoo, École.
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

9 replies

bruceharold
Influencer
Forum|alt.badge.img+19
  • Influencer
  • November 20, 2015
Aha - byte order versus language collation order - try bouncing the data through SQLite

 


david_r
Celebrity
  • November 23, 2015
Agree, this is necessary.

 

 

Possible workaround:

 

  • Copy sort value into temporary attribute
  • Remove all accents using PythonCaller call to 'removeAccents':

 

import fmeobjects import unicodedata as ud

 

def rmdiacritics(char): ''' Return the base character of char, by "removing" any diacritics like accents or curls and strokes and the like. ''' desc = ud.name(unicode(char)) cutoff = desc.find(' WITH ') if cutoff != -1: desc = desc[:cutoff] return ud.lookup(desc)

 

def removeAccents(feature): attribute_list = ("name", "type", "state") # Modify as needed for attrib in feature.getAllAttributeNames(): if attrib in attribute_list: value = feature.getAttribute(attrib) if value: value = unicode(value) new_value = ''.join([rmdiacritics(char) for char in value]) feature.setAttribute(attrib, new_value)

 

  • Sort on accent-less attribute
David

lars_de_vries
Forum|alt.badge.img+10
I would like another method of sorting, i.e. by date.

 

 

For now I adjust my date notation to yyyymmdd, so I can sort by number, but it would be nice to add this to the sorter.

 


david_r
Celebrity
  • July 29, 2016

This really needs to be implemented, as it is the Sorter is pretty much useless for non-English languages.

If the performance suffers too much, maybe consider having two different alphanumeric sorts, one based on byte order and one using the locale sort order (with full Unicode support).

Maybe also support custom sort orders by language group, see https://msdn.microsoft.com/en-us/library/windows/desktop/dd374060%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396


  • June 12, 2017

Agreed, as long as local and language-specific conventions are adhered to. For example, in some languages, letters with accents/diacritics are considered separate letters that may or may not follow their base letter. For example:

  • In German, letters with umlaut are treated like their non-umlauted versions
  • In Polish ?, ?, ?, ?, ?, Ó, ?, ?, and ? are all separate letters in the alphabet that follow their base letter. The same rule applies to the Spanish Ñ.
  • In Swedish, there are three extra vowels placed at the end (..., X, Y, Z, Å, Ä, Ö).

https://en.wikipedia.org/wiki/Alphabetical_order#Language-specific_conventions


rbovard
Contributor
Forum|alt.badge.img
  • Contributor
  • June 16, 2017
Thanks David, it was exactly what I was looking for!

 

 

Rémi

philippeb
Enthusiast
Forum|alt.badge.img+22
  • Enthusiast
  • January 24, 2019

Why am I able to sort correctly my accents into Data Inspector but not with the Sorter?

I'm on FME 2018.1.


  • January 25, 2019

Hi,

This order would be relevant also

Dentiste, Est, Éléphant, Ève, Être, Ë, Foire, Guignol


erooen
Contributor
Forum|alt.badge.img+2
  • Contributor
  • June 20, 2019

Using French for products so ability to select language would be good for sorter as noted, but also numeric settings. French uses a comma instead of decimal for numeric values ( (i.e. 10,12 vs 10.12 in English).