Click here to Skip to main content
15,906,569 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problem to convert my code and don't know how to search for it over google Pin
davidnz5-Apr-11 18:42
davidnz5-Apr-11 18:42 
GeneralRe: Problem to convert my code and don't know how to search for it over google Pin
Naveed7275-Apr-11 19:24
Naveed7275-Apr-11 19:24 
AnswerRe: Problem to convert my code and don't know how to search for it over google Pin
Naveed7275-Apr-11 22:10
Naveed7275-Apr-11 22:10 
AnswerRe: Problem to convert my code and don't know how to search for it over google Pin
Luc Pattyn5-Apr-11 22:47
sitebuilderLuc Pattyn5-Apr-11 22:47 
AnswerRe: Problem to convert my code and don't know how to search for it over google Pin
Luc Pattyn5-Apr-11 23:02
sitebuilderLuc Pattyn5-Apr-11 23:02 
GeneralRe: Problem to convert my code and don't know how to search for it over google Pin
Naveed7275-Apr-11 23:18
Naveed7275-Apr-11 23:18 
GeneralRe: Problem to convert my code and don't know how to search for it over google Pin
Luc Pattyn5-Apr-11 23:39
sitebuilderLuc Pattyn5-Apr-11 23:39 
AnswerRe: Problem to convert my code and don't know how to search for it over google [modified] Pin
davidnz6-Apr-11 0:10
davidnz6-Apr-11 0:10 
A bit ugly, but seems to work...

private static void TestDecode()
{
    UTF8Encoding enc = new System.Text.UTF8Encoding();
    string output = "";
    string smain = "חברות-תיירות";
    int len = smain.Length;
    int pos = 0;
    uint acode = 0;
    while (pos < smain.Length)
    {
        int pos2 = -1;
        if (smain.Length >= pos + 7 && smain.Substring(pos,6) == "&amp;#")
        {
            // We have a position starting with %amp;# so now find next ;
            pos2 = smain.IndexOf(";",pos + 6);
        }
        // If there is at least one character between # and ; and it is numeric...
        if (pos2 >= pos + 7 && uint.TryParse(smain.Substring(pos + 6, pos2 - pos - 6), out acode))
        {
            char[] c = { Convert.ToChar(acode) };
            byte[] b = enc.GetBytes(c);
            for (int i = 0; i < b.Length; i++)
            {
                output += String.Format("%{0:x2}", b[i]).ToUpper();
            }
            // Advance to pos after ;
            pos = pos2 + 1;
        }
        else
        {
            output += smain[pos];
            pos += 1;
        }
    }
    Console.WriteLine(output);
 }


modified on Wednesday, April 6, 2011 7:05 AM

GeneralRe: Problem to convert my code and don't know how to search for it over google Pin
Naveed7276-Apr-11 5:18
Naveed7276-Apr-11 5:18 
GeneralRe: Problem to convert my code and don't know how to search for it over google Pin
davidnz6-Apr-11 11:03
davidnz6-Apr-11 11:03 
QuestionC# for Smart Device Pin
kmarine01205-Apr-11 11:19
kmarine01205-Apr-11 11:19 
AnswerRe: C# for Smart Device Pin
Luc Pattyn5-Apr-11 11:39
sitebuilderLuc Pattyn5-Apr-11 11:39 
GeneralRe: C# for Smart Device Pin
kmarine01205-Apr-11 16:08
kmarine01205-Apr-11 16:08 
GeneralRe: C# for Smart Device Pin
kmarine01205-Apr-11 16:36
kmarine01205-Apr-11 16:36 
Questionhi need help plzzzzzzzzz Pin
ace3005-Apr-11 6:33
ace3005-Apr-11 6:33 
AnswerRe: hi need help plzzzzzzzzz Pin
Not Active5-Apr-11 6:55
mentorNot Active5-Apr-11 6:55 
AnswerRe: hi need help plzzzzzzzzz PinPopular
Pete O'Hanlon5-Apr-11 6:56
mvePete O'Hanlon5-Apr-11 6:56 
GeneralRe: hi need help plzzzzzzzzz Pin
ace3005-Apr-11 7:26
ace3005-Apr-11 7:26 
GeneralRe: hi need help plzzzzzzzzz Pin
Dave Kreskowiak5-Apr-11 8:16
mveDave Kreskowiak5-Apr-11 8:16 
GeneralRe: hi need help plzzzzzzzzz Pin
Pete O'Hanlon5-Apr-11 11:51
mvePete O'Hanlon5-Apr-11 11:51 
GeneralRe: hi need help plzzzzzzzzz Pin
SledgeHammer015-Apr-11 13:38
SledgeHammer015-Apr-11 13:38 
GeneralRe: hi need help plzzzzzzzzz Pin
Luc Pattyn5-Apr-11 14:59
sitebuilderLuc Pattyn5-Apr-11 14:59 
AnswerRe: hi need help plzzzzzzzzz Pin
Luc Pattyn5-Apr-11 7:16
sitebuilderLuc Pattyn5-Apr-11 7:16 
JokeRe: hi need help plzzzzzzzzz Pin
Paladin20005-Apr-11 10:19
Paladin20005-Apr-11 10:19 
AnswerRe: hi need help plzzzzzzzzz Pin
gavindon5-Apr-11 8:51
gavindon5-Apr-11 8:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.