Click here to Skip to main content
15,881,856 members
Articles / Desktop Programming / Windows Forms
Tip/Trick

Unicode to Krutidev, Krutidev to Unicode Convertor in C#

Rate me:
Please Sign up or sign in to vote.
4.40/5 (5 votes)
14 Oct 2012CPOL 127.3K   2.4K   2   45
Convertor for Unicode to Krutidev and vice-versa.

Image 1

Introduction

This application is created in C# for solving major problem of Text Conversion from Unicode to Krutidev and vice-versa.

Background

When I was trying to convert Unicode to Krutidev, I could not found any offline / desktop solution for it with the source code, then I created this for the solution by using HTML page with JavaScript, which was available by Rajbhasha.net, using JavaScript for it, and using Browser control for local execution of JavaScript and Firing Event of HTML control.

Unicode_to_Krutidev/krutitounicode.JPG

Unicode_to_Krutidev/unicodetokruti.JPG

Unicode_to_Krutidev/loadshtmlinbrowsercontrol.JPG

Using the code

C#
private string UnicodetoKruti(string strInput)
{
    string strOutPut = "";
    HtmlElementCollection theElementCollection;
    theElementCollection = webBrowser1.Document.GetElementsByTagName("input");
    foreach (HtmlElement curElement in theElementCollection)
    {
        if ((curElement.GetAttribute("id").ToString() == "unicode_text"))
        {
            curElement.SetAttribute("Value", strInput);
        }

    }
    theElementCollection = webBrowser1.Document.GetElementsByTagName("input");
    foreach (HtmlElement curElement in theElementCollection)
    {
        if (curElement.GetAttribute("id").Equals("converter"))
        {
            curElement.InvokeMember("click");
            //  javascript has a click method for we need to invoke on button and hyperlink elements.
        }
    }

    theElementCollection = webBrowser1.Document.GetElementsByTagName("input");
    foreach (HtmlElement curElement in theElementCollection)
    {
        if ((curElement.GetAttribute("id").ToString() == "legacy_text"))
        {
            strOutPut = curElement.GetAttribute("Value");
        }

    }
    return strOutPut;
} 

//this function will convert kruti text to unicode
private string KrutitoUnicode(string strInput)
{
    string strOutPut = "";
    HtmlElementCollection theElementCollection;
    theElementCollection = webBrowser1.Document.GetElementsByTagName("input");
    foreach (HtmlElement curElement in theElementCollection)
    {
        if ((curElement.GetAttribute("id").ToString() == "legacy_text"))
        {
            curElement.SetAttribute("Value", strInput);
        }
    }
    theElementCollection = webBrowser1.Document.GetElementsByTagName("input");
    foreach (HtmlElement curElement in theElementCollection)
    {
        if (curElement.GetAttribute("id").Equals("converttounicode"))
        {
            curElement.InvokeMember("click");
            //  javascript has a click method for we need to invoke on button and 
            // hyperlink elements.
        }
    }
    theElementCollection = webBrowser1.Document.GetElementsByTagName("input");
    foreach (HtmlElement curElement in theElementCollection)
    {
        if ((curElement.GetAttribute("id").ToString() == "unicode_text"))
        {
            strOutPut = curElement.GetAttribute("Value");
        }
    }
    return strOutPut;
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
India India
Anurag Tripathi, having programming experience of more then 13+ years, works on Microsoft technologies. Experienced architect for various application like Device application, Mobile Applications, Enterprise Level application. Anurag is having experience of managing team on various platforms like ASP .Net, Silverlight, MVVM, Magento, Wordpress, iPhone, WCF, Android etc.

Comments and Discussions

 
QuestionHelp me Pin
Member 824086014-Jun-13 9:32
Member 824086014-Jun-13 9:32 
AnswerRe: Help me Pin
AnuragTripathi21-Jun-13 20:41
AnuragTripathi21-Jun-13 20:41 
QuestionGreat App, but one question! Pin
ishgoel3-Jun-13 22:14
ishgoel3-Jun-13 22:14 
AnswerRe: Great App, but one question! Pin
AnuragTripathi21-Jun-13 20:43
AnuragTripathi21-Jun-13 20:43 
QuestionRe: Conversion Not working Pin
Member 113611168-Jan-15 1:16
Member 113611168-Jan-15 1:16 
Questionplease help me Pin
devraj13046-Dec-12 23:09
devraj13046-Dec-12 23:09 
AnswerRe: please help me Pin
AnuragTripathi7-Dec-12 18:41
AnuragTripathi7-Dec-12 18:41 
GeneralRe: please help me Pin
devraj13049-Dec-12 2:56
devraj13049-Dec-12 2:56 
GeneralRe: please help me Pin
AnuragTripathi9-Dec-12 19:51
AnuragTripathi9-Dec-12 19:51 
GeneralRe: please help me Pin
devraj130414-Dec-12 2:47
devraj130414-Dec-12 2:47 
GeneralRe: please help me Pin
AnuragTripathi16-Dec-12 19:28
AnuragTripathi16-Dec-12 19:28 
GeneralRe: please help me Pin
AnuragTripathi16-Dec-12 19:46
AnuragTripathi16-Dec-12 19:46 
QuestionGr8 work Pin
Abhijeet Digraskar22-Oct-12 7:51
Abhijeet Digraskar22-Oct-12 7:51 
Bugdoes not download Pin
manishcodepro6-Oct-12 22:35
manishcodepro6-Oct-12 22:35 
GeneralRe: does not download Pin
AnuragTripathi11-Oct-12 3:58
AnuragTripathi11-Oct-12 3:58 
GeneralRe: does not download Pin
AnuragTripathi14-Oct-12 0:46
AnuragTripathi14-Oct-12 0:46 
GeneralRe: does not download Pin
Member 1046463615-Dec-15 3:06
Member 1046463615-Dec-15 3:06 
QuestionMore a tip than an article Pin
Abhinav S7-Jan-12 0:38
Abhinav S7-Jan-12 0:38 
QuestionNot an article Pin
Not Active6-Jan-12 2:16
mentorNot Active6-Jan-12 2:16 
QuestionNot an article but, Pin
Richard MacCutchan6-Jan-12 0:20
mveRichard MacCutchan6-Jan-12 0:20 

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.