Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accents (é, á, etc.) as Titles of Menu items #11

Open
keanulee opened this issue Nov 16, 2014 · 7 comments
Open

Accents (é, á, etc.) as Titles of Menu items #11

keanulee opened this issue Nov 16, 2014 · 7 comments

Comments

@keanulee
Copy link

If a character with an accent is present in the title of a menu item, the entire title is empty.

menu.items(0, [{
  title: 'Some accént'
}])
@sarfata
Copy link

sarfata commented Nov 18, 2014

@keanulee iOS or Android? Or Both?

@keanulee
Copy link
Author

Reproduced with iOS (unsure about Android)

@samuelmr
Copy link

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.

@keanulee
Copy link
Author

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).

@samuelmr
Copy link

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));
}

@samuelmr
Copy link

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.

@Meiguro
Copy link

Meiguro commented Jan 31, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants