julienXX / terminal-notifier

Send User Notifications on macOS from the command-line.
Other
6.36k stars 331 forks source link

How button text(actions) supports Chinese #282

Closed 1111mp closed 4 years ago

1111mp commented 4 years ago

I have this problem with node-notifier. https://github.com/mikaelbr/node-notifier/issues/340

notifier.removeAllListeners();
      notifier.notify(
        {
          message: 'Hello',
          wait: true,
          timeout: false,
          actions: ['确认', '取消'],
        },
        function (err, data) {
          // Will also wait until notification is closed.
          console.log('Waited');
          console.log('确认');
          console.log(err, data);
          // if(`${data}`.toString('utf8le') == '确认') {
          //   console.log('866666633333333')
          // }
        }
      );
      notifier.on('activate', () => {
        console.log('Clicked!');
      });
      notifier.on('dismissed', () => {
        console.log('Dismissed!');
      });
      // Buttons actions (lower-case):
      notifier.on('确认', () => {
        console.log('"Ok" was pressed');
      });
      notifier.on('取消', () => {
        console.log('"Cancel" was pressed');
      });

If I use Chinese, the corresponding event will not be executed. It should be that the activation type has changed after the buff is converted. image

https://github.com/mikaelbr/node-notifier/issues/340#issuecomment-671558881

I don't know how to solve this problem. I hope you can reply. Thank you.

1111mp commented 4 years ago

I have the problem on Windows 10. Sorry,I didn't make it clear. It might be an issue with snoretoast. Thanks again.