Those strings essentially the same: the right single quotation mark is Unicode character 2019, which can be represented as \u2019
.
When you run the script in your terminal, your terminal is the displaying Unicode character that you expect to see. You can verify this by running this example in your terminal shell:
$ ruby -e 'puts "We\u2019re"'
We’re
Try running the command on the terminal and copy the output file somewhere safe. Then try running the Xocde Run Script. Compare the two files, for example like this:
$ diff output1.yaml output2.yaml && echo "The files are equal"
New info from original poster:
Here is a diff between the two generated files:
< " Peace and love, y\u2019all.\n"
> " Peace and love, y’all.\n"
< "\n \u2022\t Some text. "
> "\n •\t Some text."
It looks to me like you have a language encoding issue: the language encoding that you're using when you run the script in your terminal might be different than the language encoding that XCode is using (or /bin/sh is using).
You can see what language encoding your terminal uses by running this:
$ env | grep '^LANG'
For example, I use UTF-8:
LANG=en_US.UTF-8
To find out what XCode is using, create a one line script, such as my_test.sh
like this:
env | grep '^\(LANG\|LC_\)'
Then add it to XCode Run Script. Do you get a different result when XCode runs the script?
A totally different item to try is changing the Run Script from shell to Ruby, like this.
First figure out where Ruby is:
$ command -v ruby
Mine is:
/usr/bin/ruby
Then change the XCode Run Script from this:
/bin/sh ruby my_script.rb
To this:
/usr/bin/ruby myscript.rb