Solved

Decoding the encoded characters

Posted on 2011-09-14
2
156 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

628 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