I find a script here
Mac OS X (Lion) Chrome: shortcut for "Search With Google"
which shows how to do google search using shell script in OS X Automator.
The original script is:
open "http://www.google.com/search?q=$(ruby -rcgi -e 'print CGI.escape $<.read.chomp')"
I am trying to adapt this script to a custom search for Chinese characters encoded in "gb2312".
Currently my script goes like:
open "http://www.yueyv.cn/index.asp?keyword=$(ruby -rcgi -e 'print CGI.escape $<.read.chomp.encode("gb2312")')"
It works fine in terminal. For example, if testing with character "一", the script opens http://www.yueyv.cn/index.asp?keyword=%D2%BB/
However when adding this script as a service in OS X automator, it opens http://www.yueyv.cn/index.asp?keyword=/
The code of "一" is gone.
I've googled for quite a while without a result. Can anybody help me? Thank you.