如何让我的C#应用​​程序停止显示问号 [英] How do I make my C# application stop showing question mark

查看:119
本文介绍了如何让我的C#应用​​程序停止显示问号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始用c#语言创建一个项目

已经完成

现在我要测试它在另一台电脑上运行windows 10

但它显示的是perisian字母az'?'

并且用'?'将数据再次保存到数据库?

如何解决这个问题?

请帮帮我



我的尝试:



在utf 8中创建表和数据库

I start to make a project using c# language
and it's done
now i want to test it on another pc runnig windows 10
but it show's perisian letter az '?'
and it save the data to data base again with '?'
how to fix this?
please help me

What I have tried:

create table and data base in utf 8

推荐答案

确保使用 NVARCHAR()而不是VARCHAR()(我假设您使用的是SQL Server),这对于存储Unicode字符是必要的。

内部C#总是使用Unicode,每个字符使用2个字节,除非您另行指定编码,请参阅:编码类(System.Text) [ ^ ]

另见 CultureInfo.CurrentCulture CultureInfo.CurrentCulture Property(System.Globalization) [ ^ ]
Make sure you use NVARCHAR() instead of VARCHAR() (I assume your are using SQL Server), this is necessary for storing Unicode characters.
Internally C# always uses Unicode, 2 bytes for every character, unless you specify otherwise with Encoding, see: Encoding Class (System.Text)[^]
Also see CultureInfo.CurrentCulture: CultureInfo.CurrentCulture Property (System.Globalization)[^]


这篇关于如何让我的C#应用​​程序停止显示问号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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