On 04/18/2017 12:38 PM, Stuart McDonald wrote:
I have a Heath Robinson/Rube Goldberg contraption which has a ChucK program sending an OSC message to a nodejs app which is broadcasting data to a web browser client via web sockets. My problem is that by the time the OSC messages get to nodejs the string "Höckerschwäne" is converted into "HC6ckerschwC$ne". ChucK itself can print non-ascii characters ok so I'm guessing the problem is with OSC itself.
First question to ask : what is the encoding of your string in Chuck : iso-88??-? / utf-8 / whatever ? And I suppose that utf8 is mandatory with nodejs & websocket.
The OSC 1.0 spec (http://opensoundcontrol.org/spec-1_0, link to 1.1 spec is dead) suggests ASCII only is supported for strings, although punycode is mentioned on other OSC pages (I tried punycode decoding the strings and they display gibberish). I'm wondering if the artefacts are just 16 bit characters being naively encoded as two separate ascii characters, or something similar.
You cant try to look at your string with oscdump (from the package liblo)
Anyway, I'm asking here in the (perhaps unlikely) event anyone else had been down this road before. I'm getting around the problem by doing some string replacing at the nodejs end: not ideal, but there's I've only got 3 non-ASCII characters in the mix so good enough for now.