|
Rank: Advanced Member Groups: Member
Joined: 9/6/2007 Posts: 133
|
I use the editor in a compose window for a contact form. Why does it always automatically put in this code:
<p> </p>
The space between the opening and closing tags makes it so that when a person just clicks and types in the editor, there is a space before their first letter. I tries setting <eo:Editor Html=""... but that had no affect.
Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
I believe this is needed purely because of browser quirks. Some browsers can't figure out where to place cursor unless it sees a space there. You may want to add some code to filter the output of such spaces (such as replace "<p> " with "<p>") if that is an issue for you.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 9/6/2007 Posts: 133
|
That solution did not fix it. I logged a test message to a text file instead of sending as e-mail, and this it what it shows:
<p>Â Test</p>
When it should just show:
<p>Test</p>
|
|
Rank: Advanced Member Groups: Member
Joined: 9/6/2007 Posts: 133
|
PS: The above sample was simply me writing Editor1.Html to a text file. Also, here is another post with a person having the same issue: http://www.essentialobjects.com/forum/postst4295_Editor-inserts-194-characters-throughout-message.aspx
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
We are not able to reproduce this problem. Please provide detailed step by step instructions and sample code on how to reproduce this problem and we will be happy to take a look.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 9/6/2007 Posts: 133
|
OK, here is the simplest sample I could create - note that it involves a codebehind page, and requires a "temp" directory in the same directory as the page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="temp.aspx.cs" Inherits="temp" %> <%@ Register TagPrefix="eo" Namespace="EO.Web" Assembly="EO.Web" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <eo:Editor ID="Editor1" Width="500px" Height="320px" runat="server" ToolBarSet="Basic"> <EmoticonDropDownStyle CssText="border-top: gray 1px solid; border-right: gray 1px solid; padding-right: 2px; border-top: gray 1px; padding-left: 2px; padding-bottom: 2px; border-left: gray 1px solid; padding-top: 2px; border-bottom: gray 1px solid; background-color: #fafafa"> </EmoticonDropDownStyle> <BreadcrumbLabelStyle CssText="padding-right: 6px; padding-left: 6px; font-size: 12px; padding-top: 1px; font-family: tahoma"> </BreadcrumbLabelStyle> <BreadcrumbItemSeparatorStyle CssText="width: 3px; height: 10px"></BreadcrumbItemSeparatorStyle> <HeaderStyle CssText="border-right: gray 1px solid; border-top: gray 1px solid; border-left: gray 1px solid; border-bottom: gray 1px"> </HeaderStyle> <BreadcrumbDropDownStyle CssText="border-top: gray 1px solid; border-right: gray 1px solid; padding-right: 2px; border-top: gray 1px; padding-left: 2px; padding-bottom: 2px; border-left: gray 1px solid; padding-top: 2px; border-bottom: gray 1px solid; background-color: #fafafa"> </BreadcrumbDropDownStyle> <EditAreaStyle CssText="border-right: gray 1px solid; padding-right: 0px; border-top: gray 1px solid; padding-left: 0px; padding-bottom: 0px; border-left: gray 1px solid; padding-top: 0px; border-bottom: gray 1px solid"> </EditAreaStyle> <EmoticonStyle CssText="background-color:white;border-bottom-color:#c5d3ed;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#c5d3ed;border-left-style:solid;border-left-width:1px;border-right-color:#c5d3ed;border-right-style:solid;border-right-width:1px;border-top-color:#c5d3ed;border-top-style:solid;border-top-width:1px;padding-bottom:2px;padding-left:2px;padding-right:2px;padding-top:2px;"> </EmoticonStyle> <FooterStyle CssText="border-right: gray 1px solid; padding-right: 2px; border-top: gray 1px; padding-left: 2px; padding-bottom: 2px; border-left: gray 1px solid; padding-top: 2px; border-bottom: gray 1px solid; background-color: #fafafa"> </FooterStyle> </eo:Editor> <asp:Button ID="btnTest" runat="server" OnClick="btnTest_Click" Text="Submit" /> </div> </form> </body> </html>
CODEBEHIND:
using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; public partial class temp : System.Web.UI.Page { protected void btnTest_Click(object sender, EventArgs e) { FileStream fl = new FileStream(HttpContext.Current.Server.MapPath("/temp") + "/" + "log.txt", FileMode.Create); StreamWriter fs = new StreamWriter(fl); fs.WriteLine(Editor1.Html); fs.Close(); } }
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
We tested your code on IE 8, IE 9, latest version of FireFox and Chrome and they all worked fine. We did have to change "/temp" to "~/temp" in order for MapPath to work.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 9/6/2007 Posts: 133
|
I know the code "works fine" - but that doesn't answer my original question about why it puts <p>Â Test</p> into log.txt when you type "test" into the editor and then the "Submit" button.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
By "working fine", we meant we do not see it puts "<p>Â Test</p>". We see "<p>Test</p>", not the extra "Â".
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 9/6/2007 Posts: 133
|
Well, I am not making it up. I've tested it on multiple servers, and what I describe definitely happens. Maybe when you typed "test" into the editor, you first double-clicked to select all, which would have removed the space. What you need to do is simply click in the editor, type "test" and check log.txt. It has this - every browser, multiple servers:
<p>Â test</p>
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
I understand you are not making it up. However we are not making it up either. ; ) Maybe you are running a different OS than us? Or maybe your computer has a specific program that installs a browser plug in that interferers with it? We do not know --- and unless we can see the problem, there is virtually nothing we can do about it. If you wish us to look into this further, we will either need to be able to reproduce the problem in our environment, or if you wish, you can setup a test project on your server and open up your server to us. We don't mind looking into it, we just need to see the problem in order to investigate it.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 9/6/2007 Posts: 133
|
Sorry - I didn't mean to sound accusatory. I know there are lots of things that could be different between our environments. It's just that this has been an issue that I've sort of ignored for several years now, through several different operating systems, computers, server - and at least one other person had a similar thing happen... I can open the server I am using up to you. Where can I send a private message with login credentials?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
You can click the "PM ME" button under any of our post to send a private message to us. Make sure you create a separate test project with just the code you posted above for that. If you give us FTP access, then we will need write permission as well since we may need to change files/upload test files when we investigate the problem.
Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
Your guess about encoding is correct. We looked into your server and we are having the same result on your server and our server, so we looked into the binary data in log.txt and noticed that the space is not a regular space (hex code 0x20), but instead is a "non-breaking space". "non-breaking space" is a different space character where browser will not try to wrap the line to the next line. The UTF-8 encoded form of this characther is two bytes: 0xc2a0.
If you load the same text using UTF-8 encoding, you will get the right form back ---- 0xc2a0 together represents a single space character. However if you load the same text using ANSI (Windows code page 1252) encoding, then it will regard this as two letters, where 0xc2 will be interpreted as "Â" and 0xa0 alone is being interpreted as "non-breaking space".
Hope this explains the issue to you. So just stick with UTF-8 and you should no longer have this issue.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 9/6/2007 Posts: 133
|
Thank you very much.
|
|
Rank: Advanced Member Groups: Member
Joined: 6/5/2007 Posts: 35
|
As a follow up, is there any way to suppress the <p>....</p> anyway? We use the editor for our customers to add HTML text into a job posting and the para tags interfere with how the final data is displayed. It may be that absent the <p> tags some browsers have quirks, but we'd prefer to deal with that in our code rather than have the editor 'add in' HTML that we don't want.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
Unfortunately no. For some browsers if we don't put <p></p> in it doesn't displays the insert cursor. So user won't be able enter anything at all.
Thanks
|
|