Solved

Decoding the encoded characters

Posted on 2011-09-14
2
154 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Latest thoughts on C# utilizing Mono on Linux vs .NET on Windows? 5 66
jquery tab header text 1 23
IDE for Python 5 27
Problem to Office 1 18
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

820 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