HTML entity conversion

Last post 03-22-2010, 9:28 PM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  03-22-2010, 7:56 PM 59580

    HTML entity conversion

    If I insert an em dash (HTML entity —) in the text and then run CleanUpHTMLCode() or CleanUpMicrosoftWordHTML(), the entity is changed to the unicode char 0x2014.
     
    When I send the entity — in email the em dash is displayed correctly; however, if I send the char 0x2014 in email it shows up as a regular dash.   Does anyone know why?

    Most importantly, how can I prevent  CleanUpHTMLCode() and CleanUpMicrosoftWordHTML() from changing the HTML entity — to the unicode char 0x2014? 
  •  03-22-2010, 9:28 PM 59584 in reply to 59580

    Re: HTML entity conversion

    Hi mushroom,
     
    You can add a HTML Filter. Please try the below example.
     
    1. <%@ Page Language="C#" %>   
    2.   
    3. <%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>   
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
    5.   
    6. <script runat="server">   
    7.   
    8. </script>   
    9.   
    10. <html xmlns="http://www.w3.org/1999/xhtml">   
    11. <head runat="server">   
    12.     <title>Untitled Page</title>   
    13. </head>   
    14. <body>   
    15.     <form id="form1" runat="server">   
    16.         <div>   
    17.             <CE:Editor ID="editor1" runat="server">   
    18.             </CE:Editor>   
    19.             <input type="button" id="button1" value="test" onclick="test()" />   
    20.         </div>   
    21.     </form>   
    22. </body>   
    23. </html>   
    24.   
    25. <script>   
    26. function CuteEditor_FilterHTML(editor,code)   
    27. {   
    28.  return code.replace("0x2014""&#8212;");   
    29. }   
    30. function CuteEditor_FilterCode(editor,code)   
    31. {   
    32.  return code.replace("0x2014""&#8212;");   
    33. }   
    34. </script>  
    Regards,
     
    ken
View as RSS news feed in XML