On 22 Oct 2014, at 3:08 am, quark67 <email@hidden> wrote:
What is special in AppleScript with "«" and "»" ?
There's nothing special about them -- you will get the same problem with other Unicode characters. For example:
set r to do shell script "echo \"Bonjour “ hello ” world\" | sed -E 's/ [”]/_”/g'"
Returns:
Bonjour_‚ÄùÄú hello_‚ÄùÄù world
Nigel or one of the other sed users might explain why, but on the face of it Unicode characters are not being recognised as such.
If you're using Yosemite or Mavericks, you can use an AppleScript-only solution. In Yosemite:
use AppleScript version "2.4" use scripting additions use framework "Foundation"
set theString to "Bonjour « hello » world" set anNSString to current application's NSString's stringWithString:theString set theString to (anNSString's stringByReplacingOccurrencesOfString:" [»]" withString:¬ "_»" options:(current application's NSRegularExpressionSearch) range:{0, length of theString}) as text
In Mavericks you'd have to wrap it in a Script Library.
|