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

Unicode characters show up as question marks when saved in DB

3 Answers 1426 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Kevin Finnegan
Top achievements
Rank 1
Kevin Finnegan asked on 26 Jan 2010, 04:22 PM
The application is using a RAD Editor and trying to save the HTML code for UP arrow - ↑ . The application is using recommended settings for supporting appearance of odd characters as mentioned http://www.telerik.com/help/aspnet/editor/appearanceofoddcharactersaftersavingradeditorscontentindatabase.html.

However, when I save the text from the RAD Editor to the database (the db type is ntext) , it does not save the HTML code i.e. ↑
and when displayed back in an HTML page it displays as question mark "?"

How do i get the database to save the text as ↑ from the editor?

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 27 Jan 2010, 09:44 AM
Hi Kevin,

The following KB article should be helpful to convert the ↑ symbol to its ↑ entity when submitting the content: Converting Unicode symbols to numeric HTML entities using a content filter.

You should make sure that the RadEditor is created before executing the OnClientLoad javascript function. Is it possible that you have put the JavaScript code in the head tag of your page with RadEditor?

If this is your case please put the JavaScript function below the RadEditor declaration (as it is shown in the KB article), e.g.

Copy Code
<telerik:radeditor id="RadEditor1" onclientload="OnClientLoad" runat="server">    
    <Content> content as Unicode: ↑ Б В Г Д   
    <br />  
    Original content as numeric: ↑ Б В Г Д   
    <br />    
    </Content>  
</telerik:radeditor>  
<script type="text/javascript">   
    function OnClientLoad(editor, args)   
    {   
       editor.get_filtersManager().add(new RadEditorCustomFilter());   
    }   
    RadEditorCustomFilter = function()   
    {   
       RadEditorCustomFilter.initializeBase(this);   
       this.set_isDom(false);   
       this.set_enabled(true);   
       this.set_name("RadEditor filter");   
       this.set_description("RadEditor filter description");   
    }   
    RadEditorCustomFilter.prototype =   
    {   
       getHtmlContent : function(content)   
       {   
            //Make changes to the content and return it   
            //Convert all symbols to their numeric HTML entities   
            newContent = content.replace(/↑/gi, "↑");    
            newContent = newContent.replace(/Б/gi, "Б");    
            newContent = newContent.replace(/В/gi, "В");    
            newContent = newContent.replace(/Г/gi, "Г");    
            newContent = newContent.replace(/Д/gi, "Д");    
            //Go ahead and add all letters. Note: this will likely cause a performance problem    
            //newContentnewContent = newContent.toUpperCase();   
         return newContent;   
       
    }   
    RadEditorCustomFilter.registerClass('RadEditorCustomFilter', Telerik.Web.UI.Editor.Filter);   
</script>

For your convenience I have attached my test project.


You should also ensure that the encoding set in the globalization section of the web.config is UTF-8

<globalization fileEncoding="UTF-8"/>



Greetings,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Mayuresh Sawardekar
Top achievements
Rank 1
answered on 09 Mar 2010, 06:02 PM
Now some of the unicode characters work where as some of them appear as question marks. See attached screeshot.

Thanks
0
Rumen
Telerik team
answered on 10 Mar 2010, 04:41 PM
Hi Mayuresh,

You should try the suggestions in this help article: Appearance Of Odd Characters After Saving Radeditor's Content In Database.

Best regards,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Editor
Asked by
Kevin Finnegan
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Mayuresh Sawardekar
Top achievements
Rank 1
Share this question
or