Unicode issue when using transformation?

I’m trying to use MAP and transformation files to translate values to swedish, but for some reason this doesn’t work. First I thought it could be some problem with unicode in the BasicUI, but it works as it should when I use the swedish characters directly in labels.

// sv.map
...
WANING_GIBBOUS=Avtagande halvmåne
...

// test.sitemap
...
Frame {
    Text item=Moon_Phase		label="Månfas [MAP(sv.map):%s]"
}
...

This is presented in BasicUI as:

The Swedish character “å” is presented as it should when in a label, but not when used in a map-file. I get the same result when using Safari on Mac, Chrome on Mac, Safari on iOS or the native OpenHAB-app on iOS. Is this a known limitation or am I doing something wrong?

  • Platform information:
    • Hardware: _CPUArchitecture/RAM/storage: Raspberry Pi
    • OS: _what OS is used and which version: Openhabian
    • openHAB version: 2.5 M4

Just a guess…is your map file in UTF-8?

You can check it with this command in the raspberry:

file pathToYourFile

It should give you back the encoding of the file

Thanks, but I don’t think that is the problem. I’m editing with VS Code on a Mac and it says UTF-8 in the status bar.

Old but relevant posting -

1 Like

Ok, thanks. Obviously platform dependent. I thought I was missing something after reading the thread below but I will try the method with unicode escape characters. Seems like the best way is to convert the file using the native2ascii tool.