Japanese characters are encoded with an escaped reference when you switch to HTML view after you save Japanese characters in the HTMLPlaceholder control in Content Management Server 2002 SP2

Article translations Article translations
Article ID: 925847 - View products that this article applies to.
Expand all | Collapse all

SYMPTOMS

You install Microsoft Content Management Server (MCMS) 2002 Service Pack 2. When you switch to HTML view after you save Japanese characters in the HTMLPlaceholder control, you notice that the Japanese characters are encoded with an escaped reference. For example, you may see an escaped reference, such as &#12345.

WORKAROUND

To work around this problem, follow these steps:
  1. Create a Microsoft Visual Basic Scripting Edition (VBScript) file that is named ActiveXToolbarHooks.vbs and that has the following code.
    On Error Resume Next
    
    Dim previousEditingSourceState
    previousEditingSourceState = false
    
    Call EnableCompatibleToolbarHooks
    
    Sub OnToolbarInitialize( ByVal pToolbarInterface )
        ' No action required
    End Sub
    
    Sub OnToolbarStateInitialize( ByVal strPlaceholderName, ByVal pState )
        ' No action required
    End Sub
    
    Sub OnToolbarUpdate( ByVal pActiveHtmlEditor, ByVal bEditingSource )
        ' If switching from typical view to HTML source 
    ‘ editing then perform a special decode operation
        If (Not previousEditingSourceState) And bEditingSource Then
            pActiveHtmlEditor.dom.body.innerHtml = 
    DecodeUnicodeChars(pActiveHtmlEditor.dom.body.innerHtml)
        Else
        End If
        previousEditingSourceState = bEditingSource
    End Sub
    
    Sub OnToolbarEvent( Byval pActiveHtmlEditor, ByVal bstrId, 
    ByVal pItem, ByVal bEditingSource )
        ' No action required
    End Sub
    
    Function DecodeUnicodeChars(inputHTML)
    
        Dim charEntityRegExp
        Set charEntityRegExp = New RegExp
        charEntityRegExp.Pattern = "&#(\d{1,5});"
    
        charEntityRegExp.Multiline = True
        charEntityRegExp.Global = True
        charEntityRegExp.IgnoreCase = True
    
        Dim outputHtml
        outputHtml = inputHtml      
    
        outputHtml = charEntityRegExp.Replace(outputHtml, GetRef("DecodeMatchedChar"))
    
        Set charEntityRegExp = Nothing
    
        DecodeUnicodeChars = outputHtml     
    End Function
    
    Function DecodeMatchedChar(fullMatch, subMatch, position, sourceString)  
        DecodeMatchedChar = ChrW(subMatch)
    End Function  
    
  2. Copy the ActiveXToolbarHooks.vbs file to the MCMS server location that is available by a virtual path. For example, you may copy the file to the MCMS project directory.
  3. Add the following code to every active server page (ASPX) template file in the MCMS project. Alternatively, you may add the following code to DefaultConsole.aspx file and then add the user control to all ASPX template files.
    <cms:AuthoringModeContainer mode="Both" runat="server" id="UnicodeHtmlFixup">
    <script language="vbscript" type="text/vbscript" src="/<cmsproject>/ActiveXToolbarHooks.vbs"></script>
    </cms:AuthoringModeContainer>
    
    Notes
    • <cmsproject> is a placeholder for the relative path of the ActiveXToolbarHooks.vbs file.
    • Make sure that you use the following MCMS tag prefix:
      <%@ Register TagPrefix="Cms" Namespace="Microsoft.ContentManagement.WebControls" 
      Assembly="Microsoft.ContentManagement.WebControls" %>
      
    • After you complete these steps, the encoded Japanese characters will be decoded in the HTML view when you save a posting.

Properties

Article ID: 925847 - Last Review: October 26, 2007 - Revision: 2.3
APPLIES TO
  • Microsoft Content Management Server 2002 Service Pack 2
Keywords: 
kbqfe kbprb KB925847

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com