Re: Using AppleScript to Detect Nul Characters
Re: Using AppleScript to Detect Nul Characters
- Subject: Re: Using AppleScript to Detect Nul Characters
- From: Gnarlodious <email@hidden>
- Date: Sat, 30 Apr 2005 09:17:08 -0600
Not too sure what you're talking about, but Keychain's password field holds
a 128 byte word, all of which are nul characters except for the password
characters:
tell application "Keychain Scripting"
tell keychain (name of current keychain)
unlock
set theKey to first key whose name is "Ashby-MacMini"
set theUsername to (account of theKey) as string
set thePassword to (do shell script "echo " & (password of theKey) &
" | sed 's|" & (ASCII character 0) & "*||' ") as string
end tell
end tell
This kind of thing can drive you crazy, since nul characters are
nonprinting.
As you can see, the script inserts the ASCII 0 character in the replacement
string and lops off the password at the first ASCII 0 character.
-- Gnarlie
Entity Bernardo Hoehl spoke thus:
> Hi Folks,
> I have this Applescript studio application I use for sending out
> emails, it uses the Postfix daemon buit into my Mac Os X box, and a 3
> SMTP servers (out of hundreds I send emails to) were refusing my
> messages replying "host smtp2.braspress.com.br[200.187.158.140] said:
> 550 Requested action not taken: NUL characters are not allowed. (in
> reply to end of DATA command)"
> As a novice high-level programmer, I did not know that every character
> is represented by a hex value, and that I had two "gremlins" in my
> Template text (used to send out the emails after text manipulation), I
> mean, I had two hex values = 00.
> A experienced Objective C programmer, friend of mine, taught me the
> what these Nul characters are and helped me removing these from my
> text. I was using a text application that did not show me the little
> gremlins.
> As I move on forward with my learning, I am wondering if there is an
> "AppleScript way" I can use to detect these Gremlins, and so create a
> routine in my application to check the consistency of any text I use
> for sending out emails.
> I thank you for your comments,
> Bernardo Höhl
> Rio de Janeiro - Brazil
> _______________________________________________
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden