troubleshooting Question

c# decode string

Avatar of XK8ER
XK8ERFlag for United States of America asked on
.NET ProgrammingC#
7 Comments1 Solution593 ViewsLast Modified:
Hello,
I have a string decoder that its partially working because some letters are decoded incorrectly.. how can I fix it?

original string
>>123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZ-abcdefghijklmnopqrstuvwxyz

decoded incorrectly
123456789-¿¿¿t°©¾H¿¿¿U°©¿PQRSTUVWXYZ-abcdefghijklmnopqrstuvwxyz

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Debug.Print(Hash_Decoder("bdfhjlnprZ‚„†ˆŠŒŽ’”–˜šœž ¢¤¦¨ª¬®°²´ZÂÄÆÈÊÌÎÐÒÔÖØÚÜÞàâäæèêìîðòô"));
        }

        private string Hash_Decoder(string strUserInput)
        {       
            int intLength = 0;
            int CurX = 0;
            int lngCodes = 0;
            int EncodeNumber = 2;
            string strCodes = null;
            string FirstI = null;            
            intLength = strUserInput.Length;

            while (!(CurX == intLength))
            {
                FirstI = strUserInput.Substring(CurX, 1);
                lngCodes = (int)(FirstI)[0] / EncodeNumber;
                strCodes += (char)lngCodes;
                CurX += 1;
            }
            return strCodes;
        }

    }
}
ASKER CERTIFIED SOLUTION
Ioannis Paraskevopoulos

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros