Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Set pbcopy to use UTF-8 by default' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Set pbcopy to use UTF-8 by default
Authored by: S on Jan 05, '09 08:15:58AM
Surely an even more convenient way would be set the clipboard to my_string?

[ Reply to This | # ]
Set pbcopy to use UTF-8 by default
Authored by: darick on Jan 05, '09 01:26:10PM

That may very well be true. In my case I was doing some additional processing through sed and it would have taken much more time to process within applescript. However, I still wanted to have an app in the end so applescript as a wrapper made sense.

In addition, the same problem occurs. You have to convince applescript to work with UTF-8. An example is included below.

set theFileReference to open for access fileToCopy
set theFileContents to read theFileReference as «class utf8»
close access theFileReference
set the clipboard to theFileContents

That also seems to work quite well. Is there any advantage to one method over the other? I just chose the way that made the most sense at the time.

[ Reply to This | # ]