formatter: fix for elements encoding issues

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>