<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>cr/lf problem in calling a mail window</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=562481914-11042002><FONT face=Arial color=#0000ff 
size=2>Mathieu,</FONT></SPAN></DIV>
<DIV><SPAN class=562481914-11042002><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=562481914-11042002>&nbsp;&nbsp;&nbsp; <FONT face=Arial 
color=#0000ff size=2>You are in effect&nbsp;sending this information through the 
URL, so you need to encode it.&nbsp; Otherwise the slashes can be taken as 
directory markings or escape characters... either way, you can't transfer a crlf 
as such through the querystring.&nbsp; Some server-side engines have a way 
around this; for example, ASP has a function called Server.URLEncode() that can 
be used to encode all such troublesome characters.</FONT></SPAN></DIV>
<DIV><SPAN class=562481914-11042002>&nbsp;&nbsp;&nbsp; <FONT face=Arial 
color=#0000ff size=2>The encoded value of cr/lf is %0A%0D; unfortunately, this 
throws a javascript "unterminated string constant" error, which does not happen 
with %20 (the encoded value for space).&nbsp; After some trial and error, I 
found that you have to escape the *letter* in this encoded value.&nbsp; Don't 
ask me why; perhaps someone with a better Jscript/C background can 
say.</FONT></SPAN></DIV>
<DIV><SPAN class=562481914-11042002>&nbsp;&nbsp;&nbsp; <FONT face=Arial 
color=#0000ff size=2>Anyway, the end result is that you should code like this 
example, which works (watch for line wrapping):</FONT></SPAN></DIV>
<DIV><SPAN class=562481914-11042002><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=562481914-11042002><FONT face=Arial color=#0000ff size=2>&lt;A 
HREF="javascript:window.location.href='mailto:peter@brunone.com?Subject=My%20Mail&amp;Body=This%20is%20separated%0\A%0\Dfrom%20this';"&gt;Javascript 
Mail&lt;/A&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=562481914-11042002><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=562481914-11042002>&nbsp;&nbsp;&nbsp; <FONT face=Arial 
color=#0000ff size=2>Let me know how this works out for you.</FONT></SPAN></DIV>
<DIV><SPAN class=562481914-11042002><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=562481914-11042002><FONT face=Arial color=#0000ff 
size=2>Cheers,</FONT></SPAN></DIV>
<DIV><SPAN class=562481914-11042002><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=562481914-11042002><FONT face=Arial color=#0000ff 
size=2>Peter</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> javascript-admin@LaTech.edu 
  [mailto:javascript-admin@LaTech.edu]<B>On Behalf Of </B>FERON 
  Matthieu<BR><B>Sent:</B> Thursday, April 11, 2002 3:57 AM<BR><B>To:</B> 
  Javascript (E-mail)<BR><B>Subject:</B> [Javascript] cr/lf problem in calling a 
  mail window<BR><BR></FONT></DIV>
  <P><FONT face=Arial size=2>Hello,</FONT> <BR><FONT face=Arial size=2>I use 
  this code to build a mail</FONT> <BR><FONT face=Arial size=2>&nbsp; 
  window.location = "<A 
  href="mailto:mymail@myserver.ext?Subject=Contribution">mailto:mymail@myserver.ext?Subject=Contribution</A> 
  HTM : &amp;Body=Titre:\nDescription:\nInsère ici un fichier zip contenant les 
  pages et images à relier\nDès que les pages seront intégrées dans le site, tu 
  recevras une confirmation par mail.";</FONT></P>
  <P><FONT face=Arial size=2>it works well and include my text in the right 
  place but the '\n' doesn't seem to work to include cr/lf.</FONT> <BR><FONT 
  face=Arial size=2>if anyone has an idea.</FONT> <BR><B><FONT 
  face="Comic Sans MS" size=2>Matthieu Féron</FONT></B> <BR><FONT 
  face="Comic Sans MS" size=1>mferon@adeuza.fr</FONT> <BR><FONT 
  face="Comic Sans MS" size=1><A href="http://ffwnet.phpnet.org" 
  target=_blank>http://ffwnet.phpnet.org</A></FONT> 
</P></BLOCKQUOTE></BODY></HTML>