Swedish letter conversion

Hi,
I have problems with Swedish letters in Ignitions Perspective module.
I'm working on a project where the customer wants the Swedish letters å, ä & ö to be displayed.
I use widgets in a dashboard to display machine status along with machine name (which sometimes inlude å,ä or ö). I let every operator create there personal dashboard and save the changes into a database with a change script on the "widgets" props of the dashboard component;
image

To view a personal dashboard I just do query to the database to retrieve it.
And use the deserilize function to display the widgets again.
However this store and retrieve procedure doesn't seems to support utf-8, letters å,ä & ö gets jumbled up. Though that an easy way to solve this would be to use the .replace function on the string. Which works fine for ä & å but not ö.
In the picture below I've tried to fit everything into the same picture, just to show what goes wrong;


Is this a bug in Ignition or what goes wrong here?

Two issues I can see right away:

  • You are not prefixing your python string constants when unicode characters are present. Should be u"ö" instead of plain "ö". (Basic requirement of python2.)

  • You are using the str() function. In python2, this does not respect unicode characters. Use the unicode() function instead.

2 Likes

Thanks a lot! That solved the issue!