Hi !
Something seems very odd to me using python from inside fme...
Note I'm french, so I handle data with a lot off accented characters. Using FME 2016 on windows server, with Python 2.7, I faced a LOT of characters encoding issues, and am still facing some puzzling situations.
for what I understood :
1) The usual mentions # -*- coding : utf8 -*- or likes, (that every text editor would use to encode the script as utf8) are ignored by FME's Python Callers' text editor, I finally figured out that the code itself is encoded by fme using windows encoding (windows-1252) in my case.
That alone could be source of errors, if the python interpreter reads
# -*- coding : utf8 -*-
someVariable = u'Projet Terminé'
While the code is encoded as windows-1252 the interpreter will try to use an utf8 codex to decode it and get the unicode value for its variable, resulting in an error.
This has a sample solution, use # -*- coding : windows-1252 -*- at the start of each script, to be sure that the interpreter and FME are on the same page... But here is the trick :
2) feature.getAttribute() fails to use the correct decoding and produces something like u'Projet Termin\xe9' so I guess he thought it was utf8, but why would he use a utf8 decoder for feature.getAttribute and cp-1252/Latin-1 for everything else ? This is still quite blurry for me.
3) When printing to FME Console, every string must be utf-8 encoded.
This is mildly infuriating...
I can't find anywhere if there are parameters to change the default encodings of FME.