How to Dynamically Convert Hexadecimal String to Urdu Using C#


In Some Application when User Passes an Hexadecimal string we need to Change that in some Languages.In this article i will describe how to convert Hexadecimal string to Urdu with Snippet of Code lines in C# and Output images.

In Some Application when User Passes an Hexadecimal string we need to Change that it in some Languages.In this article i will describe how to convert Hexadecimal to Urdu.

Suppose an Hexadecimal string is like this...

testcase1 = @"06470630062700200647064800200627062e062a0628062706310020062a06430646064806440648062c064a0627062a002006310633062706440629002006450646002000630065006c006c0065006e00740020000a0627";

We need to take 4 characters at a time and append a Unicode Character \u with this so that the Hexadecimal character will get change to urdu.Here is the below code..



public void testcase1urd(string msg)
{

Static Conversion
//char aleph;
//char ra;
//char dal;
//char wao;
//char rak;
//char rakin;
//char rakss;
//char rkos;
//char kkks;
//char jsk;
//char rkst;
//char jkst;
//char stsh;
//char ijkl;
//char kklu;
//char kjsr;
//char resr;
//char kkjjs;
//char kjils;
//char imks;
//char idrs;
//char klsr;
//char inkkr;
//char tkrsl;
//char ttsrrs;
//char urd;
//char tdksrfl;
//char tdksrf2;

//string word;



//aleph = '\u0647';
//ra = '\u0630';
//dal = '\u0627';
//wao = '\u0020';
//rak = '\u0647';
//rakin = '\u0648';
//rakss = '\u0020';
//rkos = '\u0627';
//kkks = '\u062e';
//jsk = '\u062a';
//rkst = '\u0628';
//jkst = '\u0627';
//stsh = '\u0631';
//ijkl = '\u0020';
//kklu = '\u062a';
//kjsr = '\u0643';
//resr = '\u0646';
//kkjjs = '\u0648';
//kjils = '\u0644';
//imks = '\u0648';
//idrs = '\u062c';
//klsr = '\u064a';
//inkkr = '\u0627';
//tkrsl = '\u064a';
//ttsrrs = '\u0627';
//urd = '\u062a';
//tdksrfl = '\u0020';
//tdksrf2 = '\u0631';
//char tdksrf3 = '\u0633';
//char tdksrf4 = '\u0627';
//char tdksr5 = '\u0644';
//char tdksr6 = '\u0629';
//char tdksr7 = '\u0020';
//char tdksr8 = '\u0645';
//char tdksr9 = '\u0646';
//char tdksr10 = '\u0020';
//char tdksr11 = '\u0063';
//char tdksr12 = '\u0065';
//char tdksr13 = '\u006c';
//char tdksr14 = '\u0065';
//char tkdsr15 = '\u006e';
//char tkdsr16 = '\u0074';
//char tkdsr17 = '\u0020';
//char tkdsr18 = '\u000a';
//char tkdsr19 = '\u0627';
string resultstring = string.Empty;
string word=string.Empty;
And append all the strings for word variable

This is for Dynamic conversion

while (testcase1.Length != 0)
{
string appendchar = "\\u";

//appendchar =appendchar.Replace("6789","");
string original = appendchar + testcase1.Substring(0, 4);
resultstring = resultstring + original;
// System.Text.RegularExpressions.Regex.Unescape(original.ToString());
testcase1 = testcase1.Remove(0, 4);


}
word = System.Text.RegularExpressions.Regex.Unescape(resultstring.ToString());


}


[\CODE]

I appened a \\u character.Because in C# \u character will not get appended
so i use this Regular Expression System.Text.RegularExpressions.Regex.Unescape(resultstring.ToString()); to escape one sequence i.e.('\').

The below is the Output that you will get after You run this Code...

New urdu Conversion


Article by srirama
A Good advice from parent to a Child , Master to a Student , Scholar to an Ignorant is like a doctor prescribed pill it is bitter to take but when they take it will do all good for them --- Bhushan

Follow srirama or read 73 articles authored by srirama

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: