Comments (7)
Hm. I've been doing some stuff with emoji in JS and have learned that JS can kind of suck with Unicode in general. ES6 is better, but the day for that rewrite is not yet here.
The OSC module being used is the latest, so that's not a fix.
https://github.com/TheAlphaNerd/node-osc
Do you want to do a sample app that sends what you need as an OSC blob, and we can try to tweak _handleOsc
to deal with it?
https://github.com/stimulant/ampm/blob/master/model/network.js#L163
It would be easiest for me to troubleshoot with a binary app that has a button that sends a message that repros the problem. And another button that sends it as a blob instead of a string?
In the meantime I committed a change that should at least keep it from crashing. It's on npm too.
from ampm.
Ah, I didn't realize that _handleOsc
is where the JSON is parsed before being sent to _logEvent
.
FWIW, if I send something like "Writing Chicago\u2019s Story" as the event's Category value (with the ampm Cinder sample), it shows up inside _handleOsc
as "Writing Chicago\u0012s Story". And JSON.parse() throws an exception [SyntaxError: Unexpected token �]
. So this is where it fails to parse the string. Not sure if there's a way to have JSON.parse handle UTF-16 data, but might be worth looking into that.
from ampm.
Maybe we need to do some escaping in the ampm client library?
http://stackoverflow.com/a/11654338/468472
Or escape it in _handleOsc
before passing it to JSON.parse
.
from ampm.
@endquote for reproducing, I can on Mac with the provided cinder sample by changing this line to (not sure if this will work on windows as you can't directly write utf16 in strings until vc140):
string action = "Writing Chicago\u2019s Story";
AMPMClient::get()->sendEvent( "category", action, "label", 10 );
@LRitesh hm, so it shows up as just one char off?
I've only briefly researched the js side of things, but this gist makes me think that JSON.parse can handle UTF-16 just fine (as does cinder's jsoncpp), and the problem is likely to be in node-osc's parsing, which expects ASCII chars. Here's a [vvvv forum](https://vvvv.org/forum/encode-problem-with-strings-and-umlauts-via-udposcdecoder post) with similar issues. I believe they recommend sending the data as a blob as well, base64 encoding it first. OSC can be a pain sometimes, huh.
I don't think we need to double-escape the utf-16 chars, we're able to read down the json OK from our CMS as-is, load it in the app and display it. It's just once it gets sent over OSC that things go awry.
from ampm.
@endquote I tried decodeURIComponent(message[1])
before sending it to _logEvent
but running into the same issue still.
@richardeakin I was looking at that gist as well. It does sound like the issue might be in node-osc's parsing, because it's replacing \u2019 to \u0012 before JSON parse is even used on the string.
from ampm.
How do you get the Mac Cinder sample to build on Yosemite? I don't think environment variables are really a thing anymore. Do we need to update the readme?
https://github.com/stimulant/ampm/blob/master/samples/Cinder/README.md
from ampm.
I haven't added anything related to app transport myself, but I've only done brief testing on Mac while our main target is win10.
from ampm.
Related Issues (20)
- Space in user path error? HOT 8
- Support for arbitrary commands
- Support comments in config files HOT 1
- Support for custom branding
- Debug mode
- rewrite/refactor/update
- ampm portfolio
- file name and line number for error logging HOT 4
- Screenshot support for Raspberry Pi? HOT 2
- Monitor console output of launched app HOT 1
- Have ampm serve it's own Javascript client library
- Support multiple sideCommand items. HOT 1
- Google Analytics events cap HOT 5
- Possible to update "heartbeatTimeout" from app via OSC? HOT 3
- ampm on linux? HOT 2
- Limit the rate of emails
- Bad path to server.js, in start.js. ampm never starts HOT 6
- restart app on crash HOT 1
- Java Application Monitoring HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ampm.