Hi,
Does anyone know how to properly set the url that includes Chinese characters with the Open URL action?
Test URL:
I tried this below but it failed:
I also tried the Percent Encode for URL before it and it still failed.
Thanks!
Hi,
Does anyone know how to properly set the url that includes Chinese characters with the Open URL action?
Test URL:
I tried this below but it failed:
I also tried the Percent Encode for URL before it and it still failed.
Thanks!
Hi @martin,
Using this action
loads the desired web page into the clipboard. I was then able to paste into an HTML editor to actually see the web page.
I don't know if that's helpful to you or not, that's your call!
Thanks. But that's not what I wanted. I want to open the url in a web browser.
Hey @peternlewis,
I was able to percent-encode the Chinese characters and get the URL to work via AppleScript:
open location "https://www.youtube.com/results?search_query=%E7%BC%96%E7%A8%8B"
But the same URL is still rejected by Keyboard Maestro...
-Chris
Did you turn off token processing? Seems to work fine for me.
Yes, I know. That’s why I said
The simplest solution here might be not to percent encode the whole URL (that also encodes the colon and slashes and other characters the URL needs to function, which is why the macro fails when you try that) but only the search query, and to use that as a variable in conjunction with a predefined URL:
Example Macro.kmmacros (1.6 KB)
Hey Friends,
Thanks a lot for helping out. This is very helpful!
Both @peternlewis and @gglick have provided the solution. I'm gonna mark @gglick's post as solution since it is more nuanced.
The wiki page is very brief. I hope it can be updated regarding this issue.
@peternlewis, is it possible to add native Chinese character (probably other languages as well) support in the action so that it will work with urls such as https://www.youtube.com/results?search_query=编程
? It is more intuitive.
It is interesting to note that different browsers also handle this differently.
Microsoft Edge, Safari, and Firefox show:
But Vivaldi shows:
Hmm. I was sure I had tried that last night, but I just tried again – and it worked...
The URL has to be a valid URL, as defined by the NSURL and the URL specification.
Native characters are not valid in a URL, regardless of browsers being permissive and allowing their use.