2

I recently started using OpenWhisk and love it. Everything seems to work real nice, except I have run into some issue which might be related to character sets / encoding.

E.g. when I use "Scandinavian characters", like æ, ø, å, I see this in the OpenWhisk Web Editor when calling an action / trigger with payload like:

{
    "station": "Rådhuset",
    "no2": 8.7,
    "pm10": 6.5,
    "pm25": 2.2,
    "time": 1461348000,
    "id": "Rådhuset-1461348000"
}

I get the following result / response payload:

{
    "notify": "Station R??dhuset != R���dhuset"
}

The main function in the action called looks like this:

var payload = params.payload || params;
var station = 'Rådhuset';
if (station == payload.station) {
...
} else
return whisk.done({notify : 'Station ' + station + ' != ' + payload.station});

When running the action without these characters, e.g. "Kirkeveien", everything works fine.

Has anyone else run into similar situation?!

Ilya Chumakov
  • 23,161
  • 9
  • 86
  • 114
tverilytt
  • 73
  • 1
  • 2
  • 8

2 Answers2

0

There is a known defect with non-ASCII characters. https://github.com/openwhisk/openwhisk/issues/252

A possible workaround is to encode the string (base64 encoding for example).

user6062970
  • 831
  • 4
  • 5
  • Thanks! I have considered doing some kind of encoding. But the data source, in this scenario, is Cloudant, I don't know if I can do anything before the JSON document arrives in my OpenWhisk action?! – tverilytt Apr 24 '16 at 18:14
0

try encoding:

var payload = params.payload || params;
var station = 'Rådhuset';
if (station == payload.station) {
...
} else
return whisk.done({notify : 'Station ' + encodeURIComponent(station) + ' != ' + encodeURIComponent(payload.station)});