Bugzilla@Mozdev – Bug 26345
Unexpected "Â" character in mail body
Last modified: 2017-02-28 22:55:44
You need to log in before you can comment on or make changes to this bug.
When I use the latest version of SmartTemplate4 with a reply or forward at the top of the original message, I see there is some extra line breaks and double-spacing. If I save any draft and then look at the Message Source of the draft, I see this code: <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body smarttemplateinserted="true" bgcolor="#FFFFFF" text="#000000"> <div id="smartTemplate4-template"> <p>Â </p> </div> <br> This <p>Â </p> code is doing it. It is not in either of my reply or forward codes which are both: <div align="left"><font color="#000000" face="Tahoma" size="2"><hr color="#000000" size="1"><b>Subject:</b> %subject% <b>Sent:</b> %X:=sent% %a%. %n%/%e%/%Y% %l%:%M%:%S% %p% %tz_name% %date_tz% <b>From:</b> %from(name,bracketMail(angle))% <b>To:</b> %to(name,bracketMail(angle))% [[<b>Cc:</b> %cc(name,bracketMail(angle))%]]</font></div>
Thunderbird has (by default) enabled the paragraph mode. What you call "double spacing" is proper spacing for paragraphs (all paragraphs have extra space at the bottom, just like in word processors or outlook) - which means that paragraphs do not need two line breaks <br><br> like in a plain text file. The advantage is proper layout and only having to hit [Enter] once for a paragraph. I do not know where the  character comes from. By default, Thunderbird enters <p> <br/><p> in an empty email. To disable paragraph mode (but I recommend to ave it enabled) go to Thunderbird Options > Composition > General and uncheck "When using paragraph format the enter key creates a new paragraph" In SmartTemplate options (advanced) click the Global Settings tab. in the "Advanced Functions" group, disable "Force Paragraph Mode". I usually recommend having both options enabled and using something like this as Template text: <p>Dear %from(firstname)%,</p> <p>%cursor%</p> This is easy to use and creates paragraphs that are pleasant to the eye. Single line breaks are usually not needed (emails are automatically wrapped) but can be created by using SHIFT+Enter.
That got rid of the double-spacing issue. If I want a new paragraph, I'll hit the ENTER key twice. There is still a weird single character being caused by this "Â " after disabling paragraph mode: <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body smarttemplateinserted="true" bgcolor="#FFFFFF" text="#000000"> <div id="smartTemplate4-template">Â </div> <br>
(In reply to comment #2) > That got rid of the double-spacing issue. If I want a new paragraph, I'll hit > the ENTER key twice. good. that's two line breaks though. technically a paragraph is one object with certain properties (margin is one of the, and it is not necessarily exactly line height *2), but to each their own. > There is still a weird single character being caused by this "Â " after > disabling paragraph mode: > > <html> > <head> > <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> > </head> > <body smarttemplateinserted="true" bgcolor="#FFFFFF" text="#000000"> > <div id="smartTemplate4-template">Â </div> > <br> > Weird - no idea, are you sure your "template" field is empty? Maybe put something inside of it instead, e.g. xx%cursor% to see where the character is created (before or after xx). Are you using any other extensions that mess with composer?
(In reply to comment #3) > Weird - no idea, are you sure your "template" field is empty? Maybe put > something inside of it instead, e.g. > xx%cursor% > > to see where the character is created (before or after xx). Are you using any > other extensions that mess with composer? > Putting xx%cursor% in the Template field (which was entirely empty) puts the xx before the cursor and the space of the missing character highlights the space immediately after. The only extensions I have in Thunderbird are: - Lightning. - Send Later. - SmartTemplate4. - uBlock Origin. - Enigmail (disabled).
I just sent you an email with a picture of the cursor to hopefully show what i am trying to explain better. Here is the code from the email: <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body smarttemplateinserted="true" bgcolor="#FFFFFF" text="#000000"> <div id="smartTemplate4-template">xx </div> <br> <div id="smartTemplate4-quoteHeader"> <div align="left"><font face="Tahoma" color="#000000" size="2"> <hr color="#000000" size="1"><b>Subject:</b> [smarttemplate4] [Bug 26345] Uneexpected "Â" character in mail body<br> <b>Sent:</b> Fri. 2/24/2017 1:28:42 PM CST -0600<br> <b>From:</b> bugzilla-daemon <a class="moz-txt-link-rfc2396E" href="mailto:bugzilla-daemon@mozdev.mozdev.org"><bugzilla-daemon@mozdev.mozdev.org></a><br> <b>To:</b> SNIP <a class="moz-txt-link-rfc2396E" href="mailto:SNIP@SNIP.net"><SNIP@SNIP.net></a><br> </font></div> </div>
Created an attachment (id=8274) [details] SmartTemplate 1.5 pre 17 please test the original test case (with paragaph mode enabled) whether this removes the strange character. Make sure you have the SmartTemplate4 Global Setting "Insert space to highlight %cursor%" disabled.
With the attached file and the settings you asked to be enabled, I get a new paragraph under the xx. At the start of the new paragraph is where the cursor is. Here is the HTML code from the email: <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body smarttemplateinserted="true" bgcolor="#FFFFFF" text="#000000"> <div id="smartTemplate4-template">xx <p></p> </div> <br> <div id="smartTemplate4-quoteHeader"> With "Force Paragraph Mode" in SmartTemplate disabled: <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body smarttemplateinserted="true" bgcolor="#FFFFFF" text="#000000"> <div id="smartTemplate4-template">xx</div> <br> <div id="smartTemplate4-quoteHeader"> With "When using paragraph format,..." disabled in TB Composition settings (SAME AS ABOVE): <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body smarttemplateinserted="true" bgcolor="#FFFFFF" text="#000000"> <div id="smartTemplate4-template">xx</div> <br> <div id="smartTemplate4-quoteHeader"> And with xx%cursor% removed from the Template section: <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body smarttemplateinserted="true" bgcolor="#FFFFFF" text="#000000"> <div id="smartTemplate4-template"></div> <br> <div id="smartTemplate4-quoteHeader"> So I think this is good fix, but might I suggest: 1) Have another <br> so the last code I posted would look like this: <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body smarttemplateinserted="true" bgcolor="#FFFFFF" text="#000000"> <div id="smartTemplate4-template"></div> <br> <br> <div id="smartTemplate4-quoteHeader"> 2) Have Force Paragraph Mode turned off by default. That is kind of a weird option. I have been using email since Pine in the mid 1990s, lol. Speaking of the <br> in #1 above, on my reply and forward headers, I had to add a <br> to get a line break bewtween my reply and the header so now I am using: <br><div align="left"><font color="#000000" face="Tahoma" size="2"><hr color="#000000" size="1"><b>Subject:</b> %subject% <b>Sent:</b> %X:=sent% %a%. %n%/%e%/%Y% %l%:%M%:%S% %p% %tz_name% %date_tz% <b>From:</b> %from(name,bracketMail(angle))% <b>To:</b> %to(name,bracketMail(angle))% [[<b>Cc:</b> %cc(name,bracketMail(angle))%]]</font></div>
Created an attachment (id=8276) [details] SmartTemplate 1.5 pre 20 Supersedes pre 17 by making the <p> visible if paragraph mode is selected. Composer removes empty <p></p> their workaround is creating <p><br></p> which st4 now does if you specify an empty paragraph with cursor in it <p>%cursor%</p>
Is the  problem resolved? (In reply to comment #7) > > 2) Have Force Paragraph Mode turned off by default. That is kind of a weird > option. I have been using email since Pine in the mid 1990s, lol. No. There are lots of users who come from word processing programs or have used HTML editors which have default paragraphs. I like it to work this way and get readable emails from people who are used to Word or Outlook. Also constantly hitting [Enter Enter] sucks and user shouldn't be forced to do that all the time (a single <br> is barely ever needed, so the inconvenient SHIFT-Enter is the logical choice for the 10% use case) Also writing text content straight into <body> can create all sorts of problems with styling, and most people don't bother wrapping everything into a <div>. > Speaking of the <br> in #1 above, on my reply and forward headers, I had to add > a <br> to get a line break between my reply and the header so now I am using: > > <br><div align="left"><font color="#000000" face="Tahoma" size="2"><hr > color="#000000" size="1"><b>Subject:</b> %subject% > <b>Sent:</b> %X:=sent% %a%. %n%/%e%/%Y% %l%:%M%:%S% %p% %tz_name% %date_tz% > <b>From:</b> %from(name,bracketMail(angle))% > <b>To:</b> %to(name,bracketMail(angle))% > [[<b>Cc:</b> %cc(name,bracketMail(angle))%]]</font></div> A better way to fix this and getting rid of the deprecated <font> tag (you know that font cannot contain any block level elements?): <div style="text-align:left; font: 12px Tahoma; margin-top: 1em;"> <hr color="#000000" size="1"> <b>Subject:</b> %subject%<br> <b>Sent:</b> %X:=sent% %a%. %n%/%e%/%Y% %l%:%M%:%S% %p% %tz_name% %date_tz%<br> <b>From:</b> %from(name,bracketMail(angle))%<br> <b>To:</b> %to(name,bracketMail(angle))%<br> [[<b>Cc:</b> %cc(name,bracketMail(angle))%]] </div> Since div is block level it will always take 100% of the width and begin in a new line. margin-top is the best way to add spacing before.
Looks good. Thanks for all your help!