Changing Device Name to 🍟 fails

Posted on
  • I've tried but failed ;(

    NRF.setAdvertising({}, {name: "🍟"});
    

    And here's what I get in my DevTools:

    utf8.js:69 Uncaught Error: Lone surrogate U+D83C is not a scalar value

    It would be nice to have at least an error in the IDE.

  • Why not use TextEncoder Web API there?

  • PRs welcome... God knows why you'd want to change the name of your Puck to be a square though ;)

    If you pre-escaped it you could do NRF.setAdvertising({}, {name: "\xF0\x9F\x8D\x9F"}); I guess? Not sure if that's the correct series of bytes for it though.

  • NRF.setAdvertising({}, {name: "\xF0\x9F\x8D\x9F"}); works great! Thanks
    I can see French Fries now ;)

About

Changing Device Name to 🍟 fails

Posted by Avatar for François @François

Actions