Coder Social home page Coder Social logo

Comments (7)

sarfata avatar sarfata commented on July 23, 2024

@keanulee iOS or Android? Or Both?

from pebblejs.

keanulee avatar keanulee commented on July 23, 2024

Reproduced with iOS (unsure about Android)

from pebblejs.

samuelmr avatar samuelmr commented on July 23, 2024

Tested on CloudPebble and Android and 'Some accént' works as expected.
With CloudPebble and iOS the same code fails (empty title on the watch).
(I'm running 2.1.0-rc2 on Android and 2.5.1 on iOS. The watch is 2.8-beta9.)

Previously when I was working with OSX SDK, I was having trouble with non-ASCII characters. Solved the issue by making sure all my source files were using UTF-8 encoding.

from pebblejs.

keanulee avatar keanulee commented on July 23, 2024

In my case the string with the accent came from another source (response of an XHR), so I don't think it has to with the JS source code encoding (the example I used above is just a simplified reproduction of the issue).

from pebblejs.

samuelmr avatar samuelmr commented on July 23, 2024

Nevertheless you should make sure your characters are in UTF-8. Just to make sure, try something like this:

menu.items(0, [{
  title: utf8(data.title)
}])

function utf8(str) {
  return unescape(encodeURI(str));
}

from pebblejs.

samuelmr avatar samuelmr commented on July 23, 2024

I bet there is an assumption somewhere that the length of a character is always one byte. In UTF-8, some characters take two bytes. Consider the following example:

var UI = require('ui');
var menu = new UI.Menu({
  sections: [{
    items: [
      {title: 'áéàè98765', // 9 characters, 13 bytes
       subtitle: 'tuvwxyz' // displays: 765
      },
      {title: '12345åäö', // 8 characters, 11 bytes
       subtitle: '987654' // displays ö
       }
    ]
  }]
});
menu.show();

The same bug is in Simply.js.

from pebblejs.

Meiguro avatar Meiguro commented on July 23, 2024
  • Support for accents have been added in 7d5d6f1, ticket #15 thanks to songfei.
  • The subtitle disappearing was reported in a ticket that seems to be missing now, but the issue has been fixed in 1ca0d8a.

It takes time for changes to propagate to CloudPebble. Sorry for the wait everyone.

Odd that Simply.js has the same bug since it uses App Message directly to serialize strings. That would be an issue with PebbleKit JS itself. I'll verify and pass that along.

from pebblejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.