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

RadEditor inserts  before two consecutive spaces

11 Answers 268 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 01 Apr 2008, 09:46 PM
Hi,
With the Prometheus version of RadEditor, if there are two consecutive spaces in a sentence, they are preceded with Â.  For example, if I type

test.  test.

and then place this into a database (using the Content property of the editor), when the string is written onto a web page it looks like this:

test.  test.

I tried using the Q3 version of RadEditor and it does not have the same issue, it just replaces one of the spaces with   which makes perfect sense.  Can anyone shed some light on this problem.

11 Answers, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 02 Apr 2008, 07:05 AM
Hi,

For some reason, the non-breaking space character (code 0xA0) is being converted to something else when you save the content. I think that this is a character encoding problem with the database column where you store the editor content. Try using a unicode type (e.g. nvarchar instead of varchar or ntext instead of text).

Sincerely yours,
Lini
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ryan
Top achievements
Rank 1
answered on 02 Apr 2008, 12:29 PM
Lini,
Thanks for your quick response.  I actually figured out the problem, I was writing this string on a classic ASP page and I needed to set the Response.Charset option before I wrote the string:

Response.Charset="UTF-8"
Response.Write(string)


I tried this with the database column set to varchar and nvarchar and it didn't make any difference.  The funny thing is that when I used the Q3 version of RadEditor I didn't need to set the Response.Charset option.  Either way, I think I solved the problem.  Thanks for the help.

0
Donovan
Top achievements
Rank 1
answered on 04 Apr 2008, 08:00 PM
I'm having this issue also.  For me, it presents itself when the content is in an HTML e-mail.  Oddly, when rendered in a browser it works fine (both e-mail andweb pages are ISO-8859-1, not UTF-8).  While ASCII 160 is a 'no-break' space (which is within the ISO-8859-1 range), it seems that our mail clients see it as the  character.  I've had to create a 'Clean' method to strip these out and manually replace them with the   literal.  Oddly the  character is not ASCII 160 but ASCII 194.  Possibly a translation issue between the original text and SMTP server?  I'm not that knowledgeable in this area...

The db storage is correct--it goes in as 160 and returns as 160.

Thoughts?  Or is this just something that e-mail clients will have to manually adjust to?

Thanks,
D.
0
chrisjob
Top achievements
Rank 1
answered on 03 Jun 2008, 11:57 AM
I downloaded the latest version of RadControls ASP.Net Ajax and i am trying to created a page, with RadEditor. I use this html content from the editor to send mails. when i get my emails, i see that consecutive spaces are changed to some other weird character. I am using this control in a usercontrol?

How do i set the encoding to utf-8?

Please help me.
0
Rumen
Telerik team
answered on 03 Jun 2008, 03:29 PM
Hi Chris,

Please, try the suggestions provided in the following help article:
Appearance of odd characters after saving RadEditor's content in Database.

You can save the ascx file with Unicode encoding using Visual Studio -> File -> Save <PageName> As -> Click on the bottom arrow dropdown button next to the Save button -> choose Save with Encoding -> choose Unicode (UTF-8 with signature). See the screenshot for more information.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Eric
Top achievements
Rank 1
answered on 10 Sep 2008, 11:57 PM
I have this same problem when two spaces are entered in the editor.  I have tried all the suggested fixes as far as adding the UTF-8 encoding in the web.config and that didn't seem to fix the problem. 

What happens for me is I have a button that will save the content of the radEditor.  During the save, I encode the content using UTF-8.  After I encode the content, if I check the individual bytes, the two white spaces are inserted at characters 194, 160, and 32.  Character 194 is the A with the accent, character 160 and 32 are spaces.  This problem is before it ever is inserted into a database or saved to a file so that is what is coming from the editor.  It should only be inserting two spaces and not adding the other character.  Is there any fix for this problem?
0
Rumen
Telerik team
answered on 11 Sep 2008, 12:30 PM
Hi Eric,

If you have set <globalization fileEncoding="UTF-8"/> in your web.config file and you still experience this problem, please open a support ticket and send a sample running project that demonstrates it. Please, provide steps to reproduce the problem.

I will examine it and once I reproduce the problem will provide guidance how to fix it.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
KSBA Techie
Top achievements
Rank 1
answered on 15 Oct 2008, 08:17 PM
We are experiencing this issue with the latest version of the RadEditor.

In our application we allow the user to export data typed into the RadEditor to Microsoft Word.  Whenever we use Firefox (version 3) it works fine, but when we use Internet Explorer (version 7) we get the "A" character with the mark above it anywhere that there are two spaces.

Here's how I reproduce the issue...

* Create a new record and type the information into the RadEditor.  Then export to Word and everything looks fine.  Let's assume that we typed "this is a test." into the RadEditor.
* Edit the record.  As soon as you click into the RadEditor to edit the text there is mysteriously an extra space at the end.  So it looks like "this is a test. " instead of "this is a test.".  If I leave that space there (I have no clue where it came from) update the record the report still renders fine in Word.
* Edit the record again.  This time I manually add an additional space at the end after that "mysterious space" and click the update button.  Now when I render the report to Word that "A" with the accent above it appears.

This only seems to be happening with IE.  When I use Firefox that "mysterious space" never appears.  Is this a bug with IE or is our application not configured properly?
0
Rumen
Telerik team
answered on 16 Oct 2008, 09:08 AM
Hi Steven Woods,

Having Â's around means that you probably do not aspx file does not have the correct encoding, you do not save the content with the correct encoding - or, alternatively, you save it in one encoding, but display on a page with a different encoding. Our suggestion is to check and make sure all is saved with the same encoding.

If you store the content in a database, then you should change the data type of the database column to nchar or ntext. The nchar type returns the Unicode character with the given integer code, as defined by the Unicode standard. You can find additional information about these SQL column types in the MSDN help center by following the next link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_na-nop_25gy.asp.

Please, try the suggestions provided in the following help article too:
Appearance of odd characters after saving RadEditor's content in Database.

You can save the ascx file with Unicode encoding using Visual Studio -> File -> Save <PageName> As -> Click on the bottom arrow dropdown button next to the Save button -> choose Save with Encoding -> choose Unicode (UTF-8 with signature).

You have to also set <globalization fileEncoding="UTF-8"/> in your web.config file.

Here are some links that discuss [file] encoding.

http://support.microsoft.com/kb/893663
http://msdn.microsoft.com/en-us/library/39d1w2xf.aspx
http://weblogs.asp.net/ssadasivuni/archive/2005/01/19/355935.aspx

The extra space at the end is due to the \r\n" being added to content when submitted. The \r\n are added for readability. Due to them when the editor's content is displayed in Html mode or in the Database it will be readable.

If you do not want these line-feed and line breaks in the produced content you can strip them with

RadEditor1.Content.Replace("\r", "").Replace("\n", "");

You can find more information in the following KB article:
"\r\n" being added to content when submitted.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
KSBA Techie
Top achievements
Rank 1
answered on 16 Oct 2008, 02:51 PM
I figured it out.  The code I was using to render the content as Word was at fault.

Here's the old code...

Response.Clear(); 
Response.ContentEncoding = Encoding.UTF8; 
Response.ContentType = "application/msword"
Response.AddHeader("Content-Disposition", "attachment; filename=test.doc"); 
 
Response.Write("<html><body>"); 
Response.Write(level.LevelDescription); 
Response.Write("</body></html>"); 
 
Response.End(); 

And here's the new code...

Response.Clear(); 
Response.ContentEncoding = Encoding.UTF8; 
Response.ContentType = "application/msword"
Response.AddHeader("Content-Disposition", "attachment; filename=test.doc"); 
 
Response.Write("<html><head><meta http-equiv='content-type' content='text/html; charset=UTF-8' /></head><body>"); 
Response.Write(level.LevelDescription); 
Response.Write("</body></html>"); 
 
Response.End(); 

After putting the meta tag in that indicates utf-8 for the Word document the weird character does not display.


0
Ed
Top achievements
Rank 1
answered on 27 Oct 2008, 07:50 PM
Just thought I'd add my own experience to the pile ... I too had the funny A characters appearing in place of tabs when saving an external file to disk.  I didn't actually find my answer in this thread but have now worked it out.  For information, the problem was in the line I used to write the content to a file -- a line I pasted directly from the Telerik demo!  In http://demos.telerik.com/aspnet/prometheus/Editor/Examples/SaveInExternalFile/DefaultCS.aspx, the C# tab gives the following example code:

 

protected void Button1_Click1(object sender, EventArgs e)
{
  //Open file for writing and write content
 
using (StreamWriter externalFile = new StreamWriter(this.MapPath(path), false))
  {
     externalFile.Write(RadEditor1.Content);
  }
}

 

For me, this needed to be:

protected void Button1_Click1(object sender, EventArgs e)
{
  //Open file for writing and write content
 
using (StreamWriter externalFile = new StreamWriter(this.MapPath(path), false, Encoding.UTF8))
  {
     externalFile.Write(RadEditor1.Content);
  }
}

Tags
Editor
Asked by
Ryan
Top achievements
Rank 1
Answers by
Lini
Telerik team
Ryan
Top achievements
Rank 1
Donovan
Top achievements
Rank 1
chrisjob
Top achievements
Rank 1
Rumen
Telerik team
Eric
Top achievements
Rank 1
KSBA Techie
Top achievements
Rank 1
Ed
Top achievements
Rank 1
Share this question
or