Solved

Decoding the encoded characters

Posted on 2011-09-14
2
152 Views
Last Modified: 2012-10-31
Hello,
I have encoded the foreign characters.  i need help with decoding.

Dim tst As String = HtmlEncode(text)

Private Function HtmlEncode(ByVal Text As String) As String
        Dim i As Integer
        Dim sb As New StringBuilder
        'Split the string into a char array.
        Dim charCode As String
        Dim charArray() As Char = Text.ToCharArray()

        'Note: Remember zero based index. Also remember length minus one to prevent out of bounds exception
        For i = 0 To charArray.Length - 1 '(i have the content in the 'text')
            charCode = AscW(charArray(i))
            If charCode > 127 Then
                sb.Append(String.Format("&#{0};", charCode))
            Else
                sb.Append(Chr(charCode))
            End If
        Next
        Return sb.ToString
    End Function

any help would be appreciated.

-M
0
Comment
Question by:Meenalu
2 Comments
 
LVL 16

Accepted Solution

by:
Easwaran Paramasivam earned 500 total points
ID: 36540853
Assuming you are working in a Web application. Use HTMLEncode and HTMLDecode method instead of writing your own.

Please do refer http://www.dotnetperls.com/httputility

If you want to perform encode/decode in Javascript side you can go for escape and unescape methods.

0
 

Author Comment

by:Meenalu
ID: 36566908
I have tried with the utility.

when i encode the characters are converted into boxes in the xml file.
and not &12393, and so on.

can i get help with the method i have written in vb.net, please?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now