C#-智能设备应用程序不显示中文文本 [英] C# - Smart Device Application not display Chinese text

查看:122
本文介绍了C#-智能设备应用程序不显示中文文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

美好的一天!

如何将智能设备应用程序国际化.我想将所有数据显示为亚洲语言(中文,越南语等)的数据网格,我为每种语言创建一个资源文件.我的问题是,它无法显示正确的字符串(还是用中文吧),而是将显示垃圾字符串o框.英文没问题,它将正确显示.


代码:

Hi All,

Good day!

How can I internationalize a smartdevice application. I want to display all data to datagrid in asian languages(Chinese, Vietnamese, etc) I create a resource file for each languages. My problem is, it was not able to display the correct string(还是用中文吧) instead it will display a garbage string o boxes. No problem in english it will display properly.


code:

private void Form1_Load(object sender, EventArgs e)
        {
            customersBindingSource = new BindingSource();
            List<customers> custList = new List<customers>();
            custList = Customers.GetAllCustomers();
            customersBindingSource.DataSource = custList;
            dataGrid1.DataSource = customersBindingSource;
            dataGrid1.TableStyles[0].GridColumnStyles[0].HeaderText = ResWMSPDA.Code_ZH;
            dataGrid1.TableStyles[0].GridColumnStyles[1].HeaderText =   ResWMSPDA.Name_ZH;
            dataGrid1.TableStyles[0].GridColumnStyles[2].HeaderText = ResWMSPDA.Address_ZH;
            dataGrid1.Dock = DockStyle.Fill;
        }
</customers></customers>


public class Customers
    {
        public string code { get; set; }
        public string name { get; set; }
        public string address { get; set; }

        public Customers(string code, string name, string address)
        {
            this.code = code;
            this.name = name;
            this.address = address;
        }

        public static List<customers> GetAllCustomers()
        {
            List<customers> tempCustomers = new List<customers>();
            Customers customer1 = new Customers("1","Customer 1","Address 1" );
            Customers customer2 = new Customers("2", "Customer 2", "Address 2");
            Customers customer3 = new Customers("3", "客户 3", "地址 3");
            Customers customer4 = new Customers("4", "客户 4", "地址 4");

            tempCustomers.Add(customer1);
            tempCustomers.Add(customer2);
            tempCustomers.Add(customer3);
            tempCustomers.Add(customer4);

            return tempCustomers;
        }
    }
</customers></customers></customers>



输出:
所有中文字符都显示垃圾字符串或垃圾箱.





非常感谢您的帮助.


非常感谢.



output:
All chinese charaters display garbage string or boxes.





Any help is highly appreciated.


Thanks you very much.

推荐答案

这些框是使用字体的标志,不支持您使用的字符.您只需要使用正确的字体即可.使用与每个Windows版本捆绑在一起的字符映射"(charmap.exe)应用程序,查看哪种字体支持哪些Unicode代码点范围.例如,字体"Arial Unicode MS"是Windows支持的最多的字体.特别是,对中文,越南文以及大多数欧洲和印度文字的支持不是问题.仅使用某些奇异的脚本可能会遇到一些问题,并且可能需要在Web上找到字体,这变得越来越可行.

—SA
Those boxes is a sign of using the font not supporting the characters you use. You need just to use the right font. Use "Character Map" (charmap.exe) application bundled with every version of Windows to see what font support which Unicode code point ranges. For example, the font "Arial Unicode MS" is the font deployed with Windows which support the most. In particular, support of Chinese, Vietnamese and most European and Indic scripts is not a problem. You can face some problems only with some exotic scripts and may need to find the fonts on the Web, which is getting more and more feasible.

—SA


这篇关于C#-智能设备应用程序不显示中文文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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