Umlauts in terminal-notifier MacOS












1















OSX-Mojave. I have a simple script:



#!/bin/bash

key="..."
text="$(echo $(pbpaste) | sed "s/["'<>]//g")"
translate="$(/usr/local/bin/wget -qO - "https://translate.yandex.net/api/v1.5/tr.json/translate?key=$key&text=$text&lang=ru")"
echo $translate | sed 's/.*["(.*)"].*/1/' | /usr/local/bin/terminal-notifier -title "$text" -subtitle "$translate"


Script work without any problem and translate content from a clipboard if was fired from a terminal. I would like to bind the script to keyboard hotkey. Did with automator, but in popup from (terminal-notifier) I do not see umlauts and that's why translation is wrong. I thought, that that problem somewhere with automatator, I compiled simple app with osascript where I starting my bash script and binded to hotkey without automator, but still the same problem. If start the app or bash script from cli, in popup I see umlauts and correct translation. But with hotkey I see the problem with umlauts again.



Could please someone explain me, where is a problem or where to search the errors. Thank you in advance!



enter image description here



enter image description here










share|improve this question

























  • First step is to inspect the API reply for encoding type, and if it's UTF-8 etc., see how the special characters are represented (single code points? combiners?), e.g. with hexdump -C .... It looks like I need an API key for this URL, so I can't try for you. Next step is to figure out what encoding terminal-notifier needs, and to convert if necessary.

    – dirkt
    Dec 19 '18 at 9:58











  • I do not understand, why starting from terminal shows correct output, but start on hotkey from GUI shows broken output

    – kbu
    Dec 19 '18 at 10:05
















1















OSX-Mojave. I have a simple script:



#!/bin/bash

key="..."
text="$(echo $(pbpaste) | sed "s/["'<>]//g")"
translate="$(/usr/local/bin/wget -qO - "https://translate.yandex.net/api/v1.5/tr.json/translate?key=$key&text=$text&lang=ru")"
echo $translate | sed 's/.*["(.*)"].*/1/' | /usr/local/bin/terminal-notifier -title "$text" -subtitle "$translate"


Script work without any problem and translate content from a clipboard if was fired from a terminal. I would like to bind the script to keyboard hotkey. Did with automator, but in popup from (terminal-notifier) I do not see umlauts and that's why translation is wrong. I thought, that that problem somewhere with automatator, I compiled simple app with osascript where I starting my bash script and binded to hotkey without automator, but still the same problem. If start the app or bash script from cli, in popup I see umlauts and correct translation. But with hotkey I see the problem with umlauts again.



Could please someone explain me, where is a problem or where to search the errors. Thank you in advance!



enter image description here



enter image description here










share|improve this question

























  • First step is to inspect the API reply for encoding type, and if it's UTF-8 etc., see how the special characters are represented (single code points? combiners?), e.g. with hexdump -C .... It looks like I need an API key for this URL, so I can't try for you. Next step is to figure out what encoding terminal-notifier needs, and to convert if necessary.

    – dirkt
    Dec 19 '18 at 9:58











  • I do not understand, why starting from terminal shows correct output, but start on hotkey from GUI shows broken output

    – kbu
    Dec 19 '18 at 10:05














1












1








1








OSX-Mojave. I have a simple script:



#!/bin/bash

key="..."
text="$(echo $(pbpaste) | sed "s/["'<>]//g")"
translate="$(/usr/local/bin/wget -qO - "https://translate.yandex.net/api/v1.5/tr.json/translate?key=$key&text=$text&lang=ru")"
echo $translate | sed 's/.*["(.*)"].*/1/' | /usr/local/bin/terminal-notifier -title "$text" -subtitle "$translate"


Script work without any problem and translate content from a clipboard if was fired from a terminal. I would like to bind the script to keyboard hotkey. Did with automator, but in popup from (terminal-notifier) I do not see umlauts and that's why translation is wrong. I thought, that that problem somewhere with automatator, I compiled simple app with osascript where I starting my bash script and binded to hotkey without automator, but still the same problem. If start the app or bash script from cli, in popup I see umlauts and correct translation. But with hotkey I see the problem with umlauts again.



Could please someone explain me, where is a problem or where to search the errors. Thank you in advance!



enter image description here



enter image description here










share|improve this question
















OSX-Mojave. I have a simple script:



#!/bin/bash

key="..."
text="$(echo $(pbpaste) | sed "s/["'<>]//g")"
translate="$(/usr/local/bin/wget -qO - "https://translate.yandex.net/api/v1.5/tr.json/translate?key=$key&text=$text&lang=ru")"
echo $translate | sed 's/.*["(.*)"].*/1/' | /usr/local/bin/terminal-notifier -title "$text" -subtitle "$translate"


Script work without any problem and translate content from a clipboard if was fired from a terminal. I would like to bind the script to keyboard hotkey. Did with automator, but in popup from (terminal-notifier) I do not see umlauts and that's why translation is wrong. I thought, that that problem somewhere with automatator, I compiled simple app with osascript where I starting my bash script and binded to hotkey without automator, but still the same problem. If start the app or bash script from cli, in popup I see umlauts and correct translation. But with hotkey I see the problem with umlauts again.



Could please someone explain me, where is a problem or where to search the errors. Thank you in advance!



enter image description here



enter image description here







macos command-line bash bash-scripting gui






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 19 '18 at 9:00









Ahmed Ashour

1,164611




1,164611










asked Dec 19 '18 at 8:00









kbukbu

61




61













  • First step is to inspect the API reply for encoding type, and if it's UTF-8 etc., see how the special characters are represented (single code points? combiners?), e.g. with hexdump -C .... It looks like I need an API key for this URL, so I can't try for you. Next step is to figure out what encoding terminal-notifier needs, and to convert if necessary.

    – dirkt
    Dec 19 '18 at 9:58











  • I do not understand, why starting from terminal shows correct output, but start on hotkey from GUI shows broken output

    – kbu
    Dec 19 '18 at 10:05



















  • First step is to inspect the API reply for encoding type, and if it's UTF-8 etc., see how the special characters are represented (single code points? combiners?), e.g. with hexdump -C .... It looks like I need an API key for this URL, so I can't try for you. Next step is to figure out what encoding terminal-notifier needs, and to convert if necessary.

    – dirkt
    Dec 19 '18 at 9:58











  • I do not understand, why starting from terminal shows correct output, but start on hotkey from GUI shows broken output

    – kbu
    Dec 19 '18 at 10:05

















First step is to inspect the API reply for encoding type, and if it's UTF-8 etc., see how the special characters are represented (single code points? combiners?), e.g. with hexdump -C .... It looks like I need an API key for this URL, so I can't try for you. Next step is to figure out what encoding terminal-notifier needs, and to convert if necessary.

– dirkt
Dec 19 '18 at 9:58





First step is to inspect the API reply for encoding type, and if it's UTF-8 etc., see how the special characters are represented (single code points? combiners?), e.g. with hexdump -C .... It looks like I need an API key for this URL, so I can't try for you. Next step is to figure out what encoding terminal-notifier needs, and to convert if necessary.

– dirkt
Dec 19 '18 at 9:58













I do not understand, why starting from terminal shows correct output, but start on hotkey from GUI shows broken output

– kbu
Dec 19 '18 at 10:05





I do not understand, why starting from terminal shows correct output, but start on hotkey from GUI shows broken output

– kbu
Dec 19 '18 at 10:05










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1385818%2fumlauts-in-terminal-notifier-macos%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1385818%2fumlauts-in-terminal-notifier-macos%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Plaza Victoria

Brian Clough

Cáceres