Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to prevent Automator's "run shell script" to create fully decomposed forms of my strings ?

I am using Automator's "run shell script" and I am seeing that it outputs fully decomposed forms of my strings.


For example, when I set the action to "echo été" in a service (with "Replace selected text" activated) and run that into a Textwrangler window, I'll get fully decomposed forms that Textwrangler won't understand. But when I simply type that command into Terminal, I get my string in composed form.


The problem is not the display issue, but the fact that if I want to run grep for example in "run shell script", I will not be able to find the proper strings since the forms are different.

iMac, Mac OS X (10.6.7)

Posted on Jun 14, 2011 8:39 PM

Reply
24 replies

Jun 15, 2011 10:10 PM in response to Jean-Christophe Helary

But they are in the same encoding. As far as I can tell from reading the web, both forms are equivalent.


What I want to do is just pass string arguments to commands with $@, like I do in Terminal.


In any case, I have filed a bug report at Apple. I suspect the cause is that Automator is using a framework that causes the issue, because the dterm utility seems to behave in similar ways.

Jun 16, 2011 5:59 PM in response to Jean-Christophe Helary

Jean-Christophe Helary wrote:


how to make sure that what I input and what it outputs are the same form (ie which command to add inside the service to ensure that this is the case).


You probably need a command which converts any string to Unicode Normalization form C. One app which has this as an individual service is UnicodeChecker.

Jun 17, 2011 6:14 PM in response to Jean-Christophe Helary

ok, I had some time to test this out. if you download and install the satimage osax, then you can use statements like the following to perform unicode-sensitive regexp directly in applescript:


set txt to "été"

set txt2 to find text "^(é.)" in txt using "\\1" with regexp and string result

set the clipboard to the result

if you feed non-decomposed characters into this, you will get non-decomposed characters out of it (though I don't think it's smart enough to mix the two.)

Sep 12, 2011 11:00 AM in response to Jean-Christophe Helary

Stumbled upon the same problem while trying to pass Japanese characters to a shell script as arguments. It works perfectly well on the Terminal; When passed as an argument via an Automator service, it all breaks down.


I discovered it was decomposing characters eg: turning ど (U+3069) into ど (U+3099), which looks about the same but was breaking the rest of my script.


Here's what worked for me, getting Automator to run an applescript which calls the shell script and passes the text to it as an argument.


Automator only decomposes the characters when calling a Shell script directly not when calling an Apple script. So, you don't need to re-write your shell-script. ^^~


Hope this helps the next guy with the same problem ^^~

How to prevent Automator's "run shell script" to create fully decomposed forms of my strings ?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.