Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

OT: Outlook wants to terminate links at whitespace

by Anonymous Monk
on Oct 20, 2006 at 20:14 UTC ( [id://579695]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a directory on my Windows Info Server that I send in a script using Mail::Sendmail on a Windows 2000 workstation:
my $mydir = "\\\\myserver\\mydir space\\dir\\"; my %mailer = ( To => $toperson, From => $fromperson, Subject => "subject here", Message => "$mydir", ); ......
The Outlook 2003 mail message cuts off the http url after the space in the outlook mail message. It shows the whole $mydir variable but cuts off the underline http url in the space part of the url \\myserver\\mydir space\\dir\\

Anyway I can correct this to show the whole url like this: \\myserver\\mydir space\\dir\\

2006-10-21 Retitled by g0n, as per Monastery guidelines
Original title: 'Space url issue'

Replies are listed 'Best First'.
Re: OT: Outlook wants to terminate links at whitespace
by ikegami (Patriarch) on Oct 20, 2006 at 20:22 UTC

    If it really was an HTTP URL or any kind of URL, then you could replace the space with %20. But it's neither a URL, nor is HTTP involved.

    The fix is to actually provide a URL. Note that forward slashes must be used.

    file:////myserver/mydir%20space/dir/
Re: OT: Outlook wants to terminate links at whitespace
by Albannach (Monsignor) on Oct 20, 2006 at 21:41 UTC
    To start with, I'd use single quotes in you definition of $mydir so as to avoid escaping your slashes, make it easier to read, and provide a visual cue that no interpolation is going on here.

    In Outlook, you can use angle brackets to contain your links, which works with either style of link and avoids the need for %20 spaces:

    <file://X:\mydir\my spaced dir\>
    or
    <\\myserver\mymappeddir\mydir\my spaced dir\>
    Update: Bah! Please ignore my bad advice on quoting, though the Outlook comment still holds. I don't know what I was thinking. Thanks to ikegami and blazar.

    --
    I'd like to be able to assign to an luser

      I'd use single quotes in you definition of $mydir so as to avoid escaping your slashes

      He'd still have to escape one of them (the first one). I usually escape them all to avoid problems down the road.

      To start with, I'd use single quotes in you definition of $mydir so as to avoid escaping your slashes, make it easier to read, and provide a visual cue that no interpolation is going on here.

      While I second that, ITYM backslashes, and sometimes they do need to be escaped in single quotes too; moreover prefixing a backslash with another one does escape it, yielding a single one:

      $ perl -l print for '\'foo', '\\\'foo', '\foo', '\\foo' 'foo \'foo \foo \foo
Re: OT: Outlook wants to terminate links at whitespace
by RobPayne (Chaplain) on Oct 21, 2006 at 16:39 UTC
    Just to be clear, you are looking for a UNC path, not a URL. Some browsers may interpret UNC paths, but this isn't a URL, as others have stated. In addition, the format for that should end up as: \\myserver\mydir space\dir

    The string in the OP contains the correct format, but the "corrected path", listed at the end has three too many backslashes.)

Re: OT: Outlook wants to terminate links at whitespace
by blazar (Canon) on Oct 21, 2006 at 11:41 UTC
    From => $fromperson, Subject => "subject here", Message => "$mydir",

    Incidentally, no need to quote $mydir, see perldoc -q quoting. I see you're not doing above, and I don't know why you're doing it on that line. Possibly it's just a remnant of something else. But I thought it would have been fair to let you know, just in case you didn't.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://579695]
Approved by andyford
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-20 01:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found