Click here to Skip to main content
15,038,451 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
How do I convert a unicode string that is in Bengali script to a plain English text?
Posted
Comments
sreeyush sudhakaran 6-Sep-15 2:31am
   
your requirement is language converter or character encoding converter?
Sultan Uz Zaman 6-Sep-15 2:41am
   
Thanks for your quick response.

To make myself clearer please find below what I intend to achieve:

For Example I have a variable named xAccount that fills in customer's account number from user input either in English or in Bengali. An account number 4005123456300 is shown as ৪০০৫১২৩৪৫৬৩০০ in Bengali since I am using Unicode. I would like to put this content to the variable xAccount as 4005123456300.
sreeyush sudhakaran 6-Sep-15 4:13am
   
Refer : http://www.c-sharpcorner.com/Forums/Thread/251941/how-to-translate-english-letterswords-to-bengali-using.aspx

http://www.codeproject.com/Articles/12711/Google-Translator

http://www.dotnetspider.com/forum/334742-How-to-translate-English-Letters-Words-to-Bengali-in-C-using-database-SQL.aspx
George Jonsson 6-Sep-15 3:10am
   
Do you mean how to translate from Bengali to English?
Sultan Uz Zaman 6-Sep-15 4:27am
   
From unicode to normal text

1 solution

I used a function to convert as follows:

C#
public string Convert2English(string bString)
        {
            int i = 0;
            string j,k="";

            for (i = 0; i <= (bString.Length - 1); i++)
            {
                j = bString.Substring(i, 1);
                switch (j)
                {
                    case "০":
                        k = k + "0";
                        break;
                    case "১":
                        k = k + "1";
                        break;
                    case "২":
                        k = k + "2";
                        break;
                    case "৩":
                        k = k + "3";
                        break;
                    case "৪":
                        k = k + "4";
                        break;
                    case "৫":
                        k = k + "5";
                        break;
                    case "৬":
                        k = k + "6";
                        break;
                    case "৭":
                        k = k + "7";
                        break;
                    case "৮":
                        k = k + "8";
                        break;
                    case "৯":
                        k = k + "9";
                        break;
                    default:
                        k = k + "";
                        break;
                }               
            }
            return k;

        }


Thanks
   
v2
Comments
Patrice T 6-Sep-15 5:38am
   
Don't use Solution for this, use Umprove question instead.

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




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900