This is a migrated thread and some comments may be shown as answers.

Paste from Word - different behaviour in ASP.NET and SharePoint

3 Answers 124 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Randall
Top achievements
Rank 2
Randall asked on 31 Oct 2008, 02:32 PM
  Hello,

I have Telerik RadControls for ASP.NET AJAX Q1 2008 (v2008.1.619.20).

I am using the RadEditor to allow users to enter comments and notes on a form on a SharePoint site.  The data is then stored in a TEXT field in a MS SQL database.  The users generally copy and paste large amounts of information from Microsoft Word, but I want the information stored in MS SQL to be just plain text (i.e., not HTML).  I am using this control because of its ability strip all formatting.  I do NOT want any formatting and I want Microsoft Words curly quotes, curly apostrophes, and big hyphens to be converted to regular quotes, regular apostrophes, and regular dashes.

When I update the TEXT field in the database, I am using the .Text property of the RadEditor instead of the .Content property.  This way, there should be no formatting to handle.  However, Words curly quotes, apostrophes, and long dashes are still present in the .Text property.  So I have code to replace these Words characters with regular characters.

This seems to work okay when I use this on an ASP.NET page.  But when I put the exact same code on a SharePoint page, RadEditor returns different values in the .Text property.

Here is the .Text property from ASP.NET:

This line has Word curly "quotes", curly ‘apostrophes’, and long—dashes.

Here is the same .Text property from SharePoint:

This line has Word curly “quotes”, curly ‘apostrophes’, and long—dashes.

As you can see, the values are different.  I captured these values using Visual Studio 2005 debug screen.

Can you tell me how why this is different and how I should use the RadEditor to enter just plain text and handle stripping out Words special characters?

Here is the RadEditor code I am using (exactly the same in the ASP.NET page and the SharePoint page):

<telerik:RadEditor ID="radEditor_Comments" runat="server" 
ContentAreaCssFile="~/Styles/vt_RadEditor_ContentArea.css"
EditModes="All"
NewLineBr="true"
StripFormattingOnPaste="MSWordRemoveAll,AllExceptNewLines" 
Width="100%"
<Modules
<telerik:EditorModule Name="RadEditorStatistics" Enabled="false" Visible="false" /> 
<telerik:EditorModule Name="RadEditorDomInspector" Enabled="false" Visible="false" /> 
<telerik:EditorModule Name="RadEditorNodeInspector" Enabled="false" Visible="false" /> 
<telerik:EditorModule Name="RadEditorHtmlInspector" Enabled="false" Visible="false" /> 
</Modules
<Tools
<telerik:EditorToolGroup /> 
</Tools
</telerik:RadEditor>

Thanks,

Randall Price

Thanks,Randall Price

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 04 Nov 2008, 12:26 PM
Hi Randall,

Please, make sure that both pages has UTF-8 encoding. You can see the attached here screenshot for more information.

The following help article could be helpful too: Appearance of odd characters after saving RadEditor's content in Database.

Kind regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Randall
Top achievements
Rank 2
answered on 04 Nov 2008, 06:46 PM
Hi Rumen,

Thanks for your quick response.  It turned out that by adding the UTF-8 attribute to my ASP.NET page fixed the differenet character issue.  Thanks very much.

Now RadEditor returns the same information in the .Text property for both ASP.NET and SharePoint.

As a further note on the RadEditor control, having the control automatically (or via a setting) convert Word curly quotes, curly apostrophes, and long dashes to their corresponding regular characters would be a great addition.  I have code that does this and it is pretty simple, but is sure would be nice to have this feature in the RadEditor control.

Thanks,

Randall Price
0
Rumen
Telerik team
answered on 05 Nov 2008, 03:46 PM
Hi Randall,

I am glad that the problem is solved now.

I would like to thank you for your feature request as well.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Randall
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Randall
Top achievements
Rank 2
Share this question
or