473,747 Members | 2,321 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WYSIWYG editor returning &gt; instead <

Howdy,

I'm using a WYSIWYG editor called TinyMCE. When I edit some text and then
save it back to my SQL server using a SQLCommand, all HTML characters are
changed to HTML code, i.e. &gt;strong&l t; instead of <strong> and so on. Is
this a problem with the editor or something else? Does .Net convert it? I
had to disable page validate request because of the tags, is there more?

Thanks,

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com


Dec 1 '05 #1
4 3031
Hi David,

Welcome to ASPNET newsgroup.
Regarding on the HTML editor html text processing question, here are some
of my understanding and suggestion:

1. As for those WYSIWYG html editors , they should directly provide the
property to let us access the raw HTML value (edited at client) when being
postback to server... Also, we need to turn off asp.net page's
validateRequest first...... You can debug through the code in IDE to
explore the text provided by the 3rd party html editor you used to verify
this...

2. As for SqlCommand , it'll directly inserted the string parameter we
provided in sqlcommand's statement or parameter, there won't have any
automatic htmlencoding, we can verify the data stored in sqlserver through
the query analyzer.....

In addition, some html editor will provide a property like "EncodedHtm l"
which is the value of the html which has been html encoded.... So I'd
suggest you verify the about things to see at what step is the raw HTML
value being converted by html encoding...

If there're anything unclear, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| From: "David Lozzi" <Da********@nos pam.nospam>
| Subject: WYSIWYG editor returning &gt; instead <
| Date: Thu, 1 Dec 2005 15:13:22 -0500
| Lines: 18
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <ec************ **@TK2MSFTNGP12 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.com cast.net 24.63.42.200
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3621 50
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Howdy,
|
| I'm using a WYSIWYG editor called TinyMCE. When I edit some text and then
| save it back to my SQL server using a SQLCommand, all HTML characters are
| changed to HTML code, i.e. &gt;strong&l t; instead of <strong> and so on.
Is
| this a problem with the editor or something else? Does .Net convert it? I
| had to disable page validate request because of the tags, is there more?
|
| Thanks,
|
| --
| David Lozzi
| Web Applications Developer
| dlozzi@(remove-this)delphi-ts.com
|
|
|
|
|

Dec 2 '05 #2
Hi David,

Does my last reply helps a little? If there're anything else we can help,
please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| X-Tomcat-ID: 90707638
| References: <ec************ **@TK2MSFTNGP12 .phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: st*****@online. microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Fri, 02 Dec 2005 04:49:20 GMT
| Subject: RE: WYSIWYG editor returning &gt; instead <
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| Message-ID: <8W************ **@TK2MSFTNGXA0 2.phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| Lines: 66
| Path: TK2MSFTNGXA02.p hx.gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3622 40
| NNTP-Posting-Host: tomcatimport2.p hx.gbl 10.201.218.182
|
| Hi David,
|
| Welcome to ASPNET newsgroup.
| Regarding on the HTML editor html text processing question, here are some
| of my understanding and suggestion:
|
| 1. As for those WYSIWYG html editors , they should directly provide the
| property to let us access the raw HTML value (edited at client) when
being
| postback to server... Also, we need to turn off asp.net page's
| validateRequest first...... You can debug through the code in IDE to
| explore the text provided by the 3rd party html editor you used to verify
| this...
|
| 2. As for SqlCommand , it'll directly inserted the string parameter we
| provided in sqlcommand's statement or parameter, there won't have any
| automatic htmlencoding, we can verify the data stored in sqlserver
through
| the query analyzer.....
|
| In addition, some html editor will provide a property like "EncodedHtm l"
| which is the value of the html which has been html encoded.... So I'd
| suggest you verify the about things to see at what step is the raw HTML
| value being converted by html encoding...
|
| If there're anything unclear, please feel free to post here.
|
| Regards,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
|
|
|
|
|
| --------------------
| | From: "David Lozzi" <Da********@nos pam.nospam>
| | Subject: WYSIWYG editor returning &gt; instead <
| | Date: Thu, 1 Dec 2005 15:13:22 -0500
| | Lines: 18
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| | X-RFC2646: Format=Flowed; Original
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| | Message-ID: <ec************ **@TK2MSFTNGP12 .phx.gbl>
| | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.com cast.net 24.63.42.200
| | Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| | Xref: TK2MSFTNGXA02.p hx.gbl
| microsoft.publi c.dotnet.framew ork.aspnet:3621 50
| | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| |
| | Howdy,
| |
| | I'm using a WYSIWYG editor called TinyMCE. When I edit some text and
then
| | save it back to my SQL server using a SQLCommand, all HTML characters
are
| | changed to HTML code, i.e. &gt;strong&l t; instead of <strong> and so
on.
| Is
| | this a problem with the editor or something else? Does .Net convert it?
I
| | had to disable page validate request because of the tags, is there more?
| |
| | Thanks,
| |
| | --
| | David Lozzi
| | Web Applications Developer
| | dlozzi@(remove-this)delphi-ts.com
| |
| |
| |
| |
| |
|
|

Dec 6 '05 #3
It appears not to have anything to do with the SQL command. I am currently
just working with a file. My script opens the file and reads the html
between two tags <editArea> and </editArea>. The HTML between the two is
then loaded into the WYSIWIG editor and looks great!. When I click Save, it
writes back to the file with the incorrect text Instead of an > it writes
&gt; and <, &lt;.

If I set the save button to only load the data from the editor into another
plain non-rtf textarea everything looks good. the > are > and < are <. I
just tried to load the text file from the second textarea independant of the
WYSIWYG editor and all of the < > are still converting to &lt; &gt;. This
seems to be independant of the editor? My code is below to open the file,
maybe something there?

I typed in the following into my textarea:
<b>this is a test</b><br>

And got this on my HTML page:
<b>this is a test</b><br>

If I put this directly into the .Write() like below, it works correctly. I
see a bold sentence.
win.Write("<b>t his is a test</b><br>")

Dim path As String = Server.MapPath( "tester.asp x")

Dim din As New StreamReader(IO .File.OpenRead( path))

Dim conts As String = din.ReadToEnd

din.Close()

Dim start As String = Left(conts, InStr(conts, "<editArea> ") + 9)

Dim midd As String = Textarea1.Value

Dim endf As String = Right(conts, Len(conts) - InStr(conts, "</editArea>") +
1)

Dim win As New StreamWriter(IO .File.OpenWrite (path))

win.Write(start & midd & endf)

win.Close()

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com

"Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
news:8W******** ******@TK2MSFTN GXA02.phx.gbl.. .
Hi David,

Welcome to ASPNET newsgroup.
Regarding on the HTML editor html text processing question, here are some
of my understanding and suggestion:

1. As for those WYSIWYG html editors , they should directly provide the
property to let us access the raw HTML value (edited at client) when being
postback to server... Also, we need to turn off asp.net page's
validateRequest first...... You can debug through the code in IDE to
explore the text provided by the 3rd party html editor you used to verify
this...

2. As for SqlCommand , it'll directly inserted the string parameter we
provided in sqlcommand's statement or parameter, there won't have any
automatic htmlencoding, we can verify the data stored in sqlserver through
the query analyzer.....

In addition, some html editor will provide a property like "EncodedHtm l"
which is the value of the html which has been html encoded.... So I'd
suggest you verify the about things to see at what step is the raw HTML
value being converted by html encoding...

If there're anything unclear, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| From: "David Lozzi" <Da********@nos pam.nospam>
| Subject: WYSIWYG editor returning &gt; instead <
| Date: Thu, 1 Dec 2005 15:13:22 -0500
| Lines: 18
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <ec************ **@TK2MSFTNGP12 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.com cast.net 24.63.42.200
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3621 50
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Howdy,
|
| I'm using a WYSIWYG editor called TinyMCE. When I edit some text and
then
| save it back to my SQL server using a SQLCommand, all HTML characters
are
| changed to HTML code, i.e. &gt;strong&l t; instead of <strong> and so on.
Is
| this a problem with the editor or something else? Does .Net convert it?
I
| had to disable page validate request because of the tags, is there more?
|
| Thanks,
|
| --
| David Lozzi
| Web Applications Developer
| dlozzi@(remove-this)delphi-ts.com
|
|
|
|
|

Dec 15 '05 #4
I think the behavior is by design and it is a good practice. You don't
want end users inserting < > into your database to read back out to
your aspx pages since they can insert a <script> block and execute some
javascript when you display this text from the database.

What needs to happen is that when you get the data out of the database
you pass it as a parameter to the HttpUtility.Ser ver.HtmlDecode( your
data). This would convert it from &lt; to < .

Also, if you really want to save the < > in the database then you can
use the same static method to decode the &lt; &gt; before its inserted
into the database.

I hope things are much clearer now.

Dec 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6006
by: wenke | last post by:
Hi, I am using the following code (see below) from php.net (http://www.php.net/manual/en/ref.xml.php, example 1) to parse an XML file (encoded in UTF-8). I changed the code slightly so that the cdata sections will be echoed an not the element names as in the original example. In the cdata sections of my XML file I have terms like this:
2
10564
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script type="text/javascript"> <!]> </script> <script type="text/javascript"
2
22952
by: Francesco Moi | last post by:
Hello. I designed a form to edit some DataBase's fields. But some of these fields contain '&lt;' and '&gt;' characters. And these characters are '<' and '>' in HTML. So if want to edit these fields, the form converts them into '<' and '>'. And I want to mantain '&lt;' and '&gt;' Mi piece of code:
18
4394
by: Timothy Casey | last post by:
Thanks in advance... =~= Timothy Casey South Australia worloq@iprimus.com.au Formerly: casey@smart.net.au
2
2453
by: bissatch | last post by:
Hi, I am currently writing a simple PHP program that uses an XML file to output rows for a 'Whats New' page. Once written, I will only require updating the XML file and any pages that use the XML file will get their row content from there. The rows may look some thing similar to this: - Added <a>mailing list</a> functionality to <a>homepage</a> - Competition winners announced, click <a>here</a>
2
6849
by: andrew007 | last post by:
I do xml / xslt transformation using asp.net but I found any value (w/xml format) in xml node html-encoded to &lt and &gt format if it's > or < tag. Since I have sub xml data in a parent xml node as a value. Check out the following problem. I want to convert the value in <WpDatesXml> node to have a valid "<" and ">" instead of &lt or &gt format so that I can use this xml for another use. Please help! <NewDataSet> <Table1>
0
1711
by: Tony | last post by:
I want to display the text of items in a bulletedlist on multiple lines, but I can't get it working. Here is a sample version of my code below: protected void blStaff_DataBound(object sender, EventArgs e) { foreach (ListItem lstItem in ((BulletedList)sender).Items) { lstItem.Text = "A" + "<br>" + "B"; } }
4
11950
by: mark4asp | last post by:
I have an element, report which contains tags which have been transformed. E.g. <pis &lt;p&gt <myXml> <report>This text has html tags in it.&lt;p&gt which but <has been changed to &lt;&gt</report> </myXml> I there a way that the XSLT transformation can render the content as html rather than text?
1
4313
by: ismailc | last post by:
Hi, I need help please. Update system to to new version & moved on to .Net2 But now my code that worked in my .Net1 xslt does not work. .Net1 fine: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:asp="remove" xmlns:igchart="remove" xmlns:igsch="remove"> &lt;td class='rowDet' id="td_<xsl:value-of select='@name' />"&gt; .Net2 don't work: <xsl:stylesheet...
0
8979
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8818
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9355
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9225
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6790
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6069
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3296
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.