Am I having encoding trouble with this script?

G'day,
I have a simple applescript, intended to get the title and url from current webpage in order to log to a text-based journaling app called Day One:
set out_file to "/Users/home/.tmp_dayone" 
tell application "Safari"          
     set current_tab to current tab of front window          
     set tab_name to name of current_tab as Unicode text          
     set get_url to URL of current_tab as Unicode text
end tell 
set text_out to "Read on the Web:  " & tab_name & " " & get_url & " " as Unicode text
set out_file_ref to open for access POSIX file out_file with write permission
try  
     write text_out to out_file_ref
end try
close access out_file_ref 
try          
     do shell script "usr/local/bin/dayone new < " & out_file
end try 
delay 0.3 
try  
     do shell script "rm " & out_file
end try
The script is obviously not very robust but mostly works. However...
...At this page http://www.ppowgallery.com/selected_work.php?artist=25 the
name of current_tab
returns this title:
"P·P·O·W | The Estate of Martin Wong | Selected Text"
Saving this to a text file and asking a shell subprocess to write a new DayOne entry from the .txt, only creates a blank entry in the journal. And I can't figure out why!
If I use less at the terminal I can see that the ' · ' character is written as '<E1>' in the .txt. Is this what is causing the problem? If I enter
file -I .tmp_dayone
at the terminal the response says the file is ISO-8859-1 encoded. I don't know if any of this is relevant; I am an amateur at all of this stuff.
Why wouldn't applescript be writing to a file as 'UTF-8" ?
Cheers!

Fair enough! I just added on errors in...
I am suspicious of the ' · ' characters. Do you think they are a likely source of the problem?
Here is the script now:
tell application "Safari"
          set current_tab to current tab of front window
          set tab_name to name of current_tab as Unicode text
          set get_url to URL of current_tab as Unicode text
end tell
set text_out to "Read on the Web:
" & tab_name & "
" & get_url & "
set out_file to "/Users/css/.tmp_dayone"
set out_file_ref to open for access POSIX file out_file with write permission
try
  write quoted form of text_out to out_file_ref
on error
          display dialog "Couldnt write to tmp file"
end try
close access out_file_ref
try
          do shell script "/usr/local/bin/dayone new < " & out_file
on error
          display dialog "shell couldnt write to Day One"
end try
delay 0.3
try
  do shell script "rm " & out_file
on error
          display dialog "shell couldnt remove tmp file"
end try

Similar Messages

  • Sorry, having real trouble with this...

    import java.lang.*;
    public class Alphabet_frequency {
         public static void main(String[] args) {
    int length_of_string;
              length_of_string = length("java");
              System.out.println(length_of_string);
    and javac tells me it can't find the symbol !!
    This is what I reckon I am doing: I am creating an int called length_of_string and then calling the length method of the String class to assign the length of the string "java" to length_of_string. What could be simpler than this ????!!!!!!!
    A bottle of wiskey to the winner...

    import java.lang.*;Redundant line - remove it.
    length_of_string = length("java");
    and javac tells me it can't find the symbol !!Of course - where is this mythical "length" method?
    This is what I reckon I am doing: I am creating an
    int called length_of_string and then calling the
    length method of the String class to assign the
    length of the string "java" to length_of_string. What
    could be simpler than this ????!!!!!!!Oh, you want to call String's length method... how about "java".length() then?
    A bottle of wiskey to the winner...Well, no thanks to that. A rootbeer would be nice but don't know how you're gonna get it to me.

  • How to import an mp3 into garageband as a track?-having some trouble with this.

    I tried to drag and drop an MP3 file (created from a wav file using Audacity) into the track/timeline area to no avail. any suggestions?

    jjazz52 wrote:
    I tried to drag and drop an MP3 file into the track/timeline area to no avail. any suggestions?
    http://www.bulletsandbones.com/GB/GBFAQ.html#mp3wontimport
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • I'm having big trouble with my new mainboard: Part II

    Hi  
    I haven't got any more replies to my post "I'm having big trouble with my new mainboard" by Krelian 2003.09.13 at 05:25. Please help! I've been struggling with this for a LONG time. And now my computer won't boot at all! Sometimes the LED's in front of the computer lights up for half a second, and nothing more happens. The only sign of life is the green light in the LAN jack. It happened after I took the ide cable for my harddrive in and out of the mainboard. This is insane, how can that suddeny happen :O ?! I was asked by wonkanoby to post max amps for my PSU, I did, and I really need to know if I maybe need a new PSU, since he asked that. Can a new PSU solve all the problems mentioned in my previous posts? Everything was fine except that I couldn't get into Windows, before i tried another harddrive on my computer. How can that complicate things so much? I have tried going barebone, and taking out the cmos battery and setting the jumpers JBAT1, J10 and J11. I have also tried every suggestion I got. Please help! I really need to get this fixed!
    -Krelian

    Some power supplies or designed so that if there is a short or overload they shut them selfs off and some will not turn back on. Some have a relay that will click back on and work, some you have to  cycle the power switch. Those that won't come back on will have to be replaced. I'm not saying that yours is that type as I have no way of telling. But if you have a friend who will loan you a good power supply you might try it. As someone else said just turning off the power will not darn all the power from some motherboards. To test this turn off your power supply than turn on the computer with the start botton. Mine will flash the lights and fans will start to spin than die. So every time you turn off computer to work on it. After turning off PSU hit the start botton to drian any power left in it before working on it. Also do this after unplugging it just to make sure.

  • TS3276 I have installed OS X Mavericks on macbook pro, macbook air & iMac but I am having terrible trouble with apple Mail. I need to take all accounts online frequently OR worse I have to quit mail and restart computer. Is anyone else having problems?

    I have installed OS X Mavericks on macbook pro, macbook air & iMac but I am having terrible trouble with apple Mail. I need to take all accounts online frequently OR worse I have to quit mail and restart computer. Is anyone else having problems?

    I just checked to see if the update to OS X Yosemite 10.10.1 solved any of the issues outlined in my previous post, and to my dismay, nothing has changed -- all of the previous problems persist.
    My iMac (8) -- it's renamed itself eight times since the recent troubleshoot with the Apple tech rep -- shows up as a shared device in Finder on my MacBook Pro, but when I click on it, I cannot establish a connection using "Connect As".  So I've attempted to connect using the menu "Go/Connect to Server...", using both (alternately) the iMac's name and IP address, to no avail.  I get a message which reads: "There was a problem connecting to the server 'Peter's iMac (8)'. This server may not exist or it is unavailable at this time.  Check the server name or IP address, check your network connection, and then try again."
    Here's what I know:
    The server -- Peter's iMac (8) does exist;
    The server -- Peter's iMac (8) is available at this time;
    The server name -- Peter's iMac (8) -- is correct, as specified in the system sharing preferences;
    The server IP address is correct, as specified in the system sharing preferences;
    The network connection is active when I attempt to connect.
    I'm convinced the problems stem directly from the OS X Yosemite update.  None of this was ever remotely an issue in the previous OS X's -- any of them.  This is maddening!  What can be done?  Apple?? Anyone???

  • I'm having a trouble with my iPhone iMessage.

    I'm having a trouble with my iPhone iMessage.
    I cannot send any pictures through iMessage only to my friend who's using iPhone4s.
    iMessage without a picture goes well.
    When I used iPhone5, everything worked fine.
    But after I change my phone from 5 to iPhone5s, it's not working well.
    please help me.
    (sending pictures to friends using iPhone5&5s is working fine. It just not works with that friend(who is using 4s) only.)

    Try this on the iPhone 5s go into settings turn iMessage off wait about 60 secs then turn it back on...under iMessage you will see it say waiting for activation...when it changes it will give a message that says iMessage can be sent blah blah blah...after you see that you will see an option that says send and receive ...click that...it should bring you yo a page that say you can be reached by iMessage at you should see you phone number with a check mark..it will be light grey...don't worry about signing into you Apple ID... You only need to do that if you are connecting you iPhone to another device (Mac, iPad, iPod touch) to receive the same iMessages on both...after that go back to the first message settings page again and at the bottom you will see mms messaging turn that off then back on....after that's done..tap you home key and send a test message
    If it still doesn't work follow this http://support.apple.com/kb/ts2755

  • Ive got an iphone 3gs and im having a trouble with its touch screen because when you sometimes tap it doesent respond?

    i ve got an iphone 3gs and im having a trouble with its touch screen because when you sometimes tap it doesent respond?

    Often a Restart and a Reset will resolve these issues...
    iPhone Reset
    http://support.apple.com/kb/ht1430
    Try this First... You will Not Lose Any Data...
    Turn the Phone Off... ( if it isn’t already )
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
    Wait for the Apple logo to Appear and then Disappear...
    Usually takes about 15 - 20 Seconds... (But can take Longer...)
    Release the Buttons...
    Turn the Phone On...

  • I am feeling so ripped off right now. I have wanted a Mac for years and believed the hype about it's stability and I have had more trouble with this Imac 2011 than I have ever had with a pc. It locks up with several software products from APP store.

    I am feeling so ripped off right now. I have wanted a Mac for years and believed the hype about it's stability and I have had more trouble with this Imac 2011 than I have ever had with a pc. It locks up with several software products from APP store. I have already had to have a technician to look at it and really couldn't figure out what the deal was.  I was told that the APP store software should give me no problems but the truth is that it locks up on the software. This machine is only 4 weeks old and I am using 37 g on a 1 T hard drive. There is no reason for it to be locking up. Also, when I try to use the help program, it always tells me that I am not connected to the internet even though I have used both the mail program and the browser with no problem just before that. I successfully used the help program on my pc lots of times. I did not need a $2000. plus machine to just get email. I just wanted to unload on somebody that might understand my pain and after checking out this site...I think there is a few of you out there.

    I was told that the APP store software should give me no problems but the truth is that it locks up on the software.
    The apps downloaded from the Mac App Store are written by third party developers, not Apple. If you have problems  with those apps you need to visit the support area for their websites. Launch the App Store, locate the app name. You should see a support link.
    when I try to use the help program, it always tells me that I am not connected to the internet even though I have used both the mail program and the browser with no problem just before that
    Go to ~/Library/Preferences. Move the com.apple.helpviewer.plist file from the Preferences folder to the Trash. Restart your Mac, try the Help menu.
    If you need help finding that file, hold down the Finder icon in the Dock then click: New Finder Window. From the menu bar top of your screen click: Go > Go to Folder. Type this in exactly as you see it here:   ~/Library/Preferences/com.apple.helpviewer.plist    That will take you right to that file.
    (.plist) files stores information about a particular app or in this case, the Help viewer. Often times deleting the .plist file resolves the issue.
    It's fine to "unload"... we understand that you expect your iMac to be stable but there are times when things go awry. That's why we have these forums so that you can you get help.
    You may want to read up on how to repair the disk if necessary or reintsall Lion >  OS X Lion: About Lion Recovery
    Apple - Find Out How - Mac Basics
    How to "switch" from PC to Mac >  Apple - Support - Switch 101
    I'm sorry you feel, "ripped off", but you are using the world's most advanced operating system and it may take some time to adjust to a new OS.   http://developer.apple.com/technologies/mac/

  • The updated iPhoto program is cumbersome.  I am trying to create a Christmas card and can't figure out how to get the fold of the card on the left and not on the top of the card.  I had no trouble with this for the past two years.  Can someone help?

    The updated iPhoto program is cumbersome.  I am trying to create a Christmas card and can't figure out how to get the fold of the card on the left and not on the top of the card.  I had no trouble with this for the past two years.  Can someone help?

    Click on the Layout button lower right and choose a Vertical lyout from the dropdown

  • My iphone 4s crashes too much when i download and app from store and open it its freeze or crash and restart the phone i think i am having big problem with this device i restored it to factory settings and no waay!

    My iphone 4s crashes too much when i download and app from store and open it its freeze or crash and restart the phone i think i am having big problem with this device i restored it to factory settings and no waay!

    I think many of us need a Defense Against the Podcasts App professor.
    Have you looked at this Apple support page?
    http://support.apple.com/kb/HT6190?viewlocale=en_US&locale=en_US

  • I am trying to publish my site so a client can view it. In the past I have not had trouble with this

    I am trying to publish my site so a client can view it. In the past I have not had trouble with this

    Adobe really does have the worst customer service/tech support of any product I have ever experienced. It is so unfortunate.
    Date: Tue, 13 Aug 2013 08:26:34 -0700
    From: [email protected]
    To: [email protected]
    Subject: I am trying to publish my site so a client can view it. In the past I have not had trouble with this
        Re: I am trying to publish my site so a client can view it. In the past I have not had trouble with this
        created by Brad Lawryk in Help with using Adobe Muse CC - View the full discussion
    We need a little more info ..
    Where are you publishing to and what is happening when you try and publish?
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5590683#5590683
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5590683#5590683
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5590683#5590683. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Help with using Adobe Muse CC by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • I'm not having any trouble with the iPhone, but the iPad is a different story. It pairs

    I'm not having any trouble with the iPhone, but the iPad is a different story. It pairs & syncs but hardly any sound or volume comes out of the Bose. Yes, the volume is turned up, it is synced & paired, but almost a whisper comes out. Anyone have any ideas? I assume it's the iPad since the phone works fine.... Help!

    Thanks.  We went to Best Buy, where we bought our phones and altho we thought we were "seeding" the ear buds far enough, we were not.  There's that extra little "click" and they were in!  So, they work well enough for our old ears.  But, thanks for your input! 

  • For everyone having memory problems with this board

    I have been working on my memory problems with this board. Memtest failed every pass yet memory was fine and board was fine. Was using Kingstone Value Ram
    Set bios version back to 1.7
    set preformance to fast
    set memory to
    2.5
    4
    4
    8
    Set voltage to 2.7 if that does not work go to 2.75
    now working great no more blue screens or os getting corupt it seems to run like a charm
    Thanks to the people who have posted sefull iformation even know you have to dig deep to find it.

    i was having mem problems with this board. But i set up bios v2.2 - ram voltage 2.75 - performance mode: slow and ram timing by SPD.
    Seems to work great for me but my video card is messed up so my comp dies every ones in a while.  

  • Importing photos from Iphone to computer and there is a message it is having trouble with this part way through on a phot and then stops

    I am having trouble importing photos onto my Mac book Pro from my Iphone...in the middle of the import I get a message stating that they are having trouble with one of my photos and then stops importing...want to save photos and clear the phone storage

    Hello cindysc
    Try importing the photos using Image Capture and see if that changes things. If it still gets stuck, try and email the photo to your self and download it that way.
    iOS: Unable to import photos to computer
    http://support.apple.com/kb/ts3195
    Regards,
    -Norm G.

  • I'm having trouble with this line: public function initHandler(event:EVENT):void

    I'm building a simple photo gallery in Flash CS4 & I've posted the entire code below, if anyone can see the problem in this code, please let me know....thanks. This code is actually from a tutorial: http://blip.tv/file/1620128/
    The tutorial had no issues with this code so I'm wondering if its just a matter of correcting a property or setting somewhere.....
    package videocode
        import flash.display.*;
        import flash.events.*;
        import flash.net.*;
        public class videoview extends MovieClip
            public var source:*;
            public var loader:Loader;
            public var loaderIndex:Number = 1;
            public function videoview()
            loader = new Loader();
            loader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
            addChild(loader);
            loadImage();
            public function initHandler(event:EVENT):void
                source = loader.content
                source.alpha = 0;
                source.x = videoarea_mc.x;
                source.y = videoarea_mc.y;
                addEventListener(Event.ENTER_FRAME, enterFrameHandler);
                protected function changeHandler(event:Event):void
                    loaderIndex = photoStepper.value
                    loadImage();
                protected function enterFrameHandler(event:Event):void
                    if (source.alpha <1){
                        source.alpha+= .1;
                    } else{
                        removeEventListener(Event.ENTER_FRAME,enterFrameHandler);
                public function getPath():String
                    return("images/image"+loader.Index+".jpeg")
                public function loadImage():void
                    loader.load(new URLRequest[getPath()]);

    public function initHandler(event:Event):void
    only the 'E' should be uppercase

Maybe you are looking for

  • How to Install Discoverer and Reports in same Laptop

    Does anyone knows how to install Discoverer 4.1 and Reports 9.1 in the same machine?

  • I cannot access iTunes in my phone

    When I try to access iTunes the screen goes white the back to homepage

  • How to convert no of days in below format

    i have two dates fields. startdate and enddate i am getting no of days from enddate - startdate for example startdate = 01-jan-11 enddate = 31-mar-11 select to_date('15-APR-12') - to_date('01-JAN-11') from dual; 470i want to display above query resul

  • Version 7.0.2a38 timeout message?

    I had problems with the release version 7.0.2.120 of QT for Windows crashing other programs that use QT. I was advised to download and use version 7.0.2a38 which worked fine. I have just received a message telling me that this version times out in 14

  • Leopard on MacBook and MacBook Pro / running repair permissions

    I upgraded both MacBook and MacBook Pro without major problems. I have been trying to repair permissions on the Mac Harddrive , and just get the spinning wheel. I have in the past run Onyx to perform routine maintenance tasks, but did not want to run