如何将马拉地语文本转换为Unicode代码 [英] How to convert Marathi Text To Unicode Code

查看:67
本文介绍了如何将马拉地语文本转换为Unicode代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个函数,它接受马拉地语文本作为输入并将马拉地语文本转换为unicode代码例如:我的函数输入将是

I want to write a function which will accept a Marathi text as input and convert the marathi text into unicode code Eg: My input to function will be

मी लाइक आहे

to

092E094000200932093E090809150020090609390947





提前谢谢



Thank you in advance

推荐答案

试试这个

传递参数(true,true)

代码--------



string marathi =मीलाइकआहे;

UnicodeEncoding ue = new UnicodeEncoding(true,true);

string s1 = BitConverter.ToString(ue.GetBytes(marathi。 ToCharArray()))。替换( - ,);





输出

092E094000200932093E090709150020090609390947
try this
pass parameter(true,true)
code--------

string marathi = "मी लाइक आहे";
UnicodeEncoding ue = new UnicodeEncoding(true,true);
string s1 = BitConverter.ToString(ue.GetBytes(marathi.ToCharArray())).Replace("-", "");


output
092E094000200932093E090709150020090609390947


byte[] array1 = Encoding.UTF32.GetBytes(txtMarathiText.Text);

        string unicodeString = Encoding.Unicode.GetString(array1);
        System.Globalization.TextElementEnumerator enumerator =
            System.Globalization.StringInfo.GetTextElementEnumerator(unicodeString);
       
        StringBuilder sb = new StringBuilder();
        while (enumerator.MoveNext())
        {
            string s = enumerator.GetTextElement();
            int i = Char.ConvertToUtf32(s, 0);

            sb.Append(string.Format("{0:X}", i.ToString()));
           
        }

        lblresult.Text = sb.ToString();





但是它给了我



But its giving me

92E094000200932093E09080915020090609390947

而不是

092E094000200932093E090809150020090609390947

它在ist位置不显示0而在150之后显示0

我的东西string.format()错了......有人可以帮我这个吗



谢谢

its not showing 0 at ist position and 0 after 150
I thing string.format() is wrong......can some one help me regarding this

Thank you


试试这段代码语句

代码



string marathi =मीलाइकआहे;

UnicodeEncoding ue = new UnicodeEncoding();

string s1 = BitConverter.ToString(ue.GetBytes(marathi.ToCharArray()))。替换( - ,);

MessageBox.Show(s1);





输出



2E094009200032093E09070915092000060939094709
Try this code statements
Code

string marathi = "मी लाइक आहे";
UnicodeEncoding ue = new UnicodeEncoding();
string s1 = BitConverter.ToString(ue.GetBytes(marathi.ToCharArray())).Replace("-", "");
MessageBox.Show(s1);


Output

2E094009200032093E09070915092000060939094709


这篇关于如何将马拉地语文本转换为Unicode代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆