Search code examples
javascriptnode-webkitnw.jsnwjs

create menu item with special characters in nwjs / node-webkit


Is it possible in node-webkit to create menu items that contain special characters like "ü", "ä", "ö"? When you create a new menu item with a special character in the label, it will display it like this (same goes for tooltips):

var menu = new nw.Menu();
menu.append(new nw.MenuItem({ label: "Spalte einfügen" }));

screenshot


Solution

  • You'll need to encode special characters in order for them to appear correctly.

    The following should work for you:

    var menu = new nw.Menu();
    menu.append(new nw.MenuItem({ label: "Spalte einf\u00FCgen" }));
    

    You can use the table at https://unicode-table.com/en/ for others, it will just be \u{Unicode Number}