[英]Showing japanese, Bengali character in html label
In my database some text are entry in japanese or bengali. 在我的数据库中,一些文本以日语或孟加拉语输入。 When i retrieve the records and display in label then a garbage is showing.
当我检索记录并在标签中显示时,则显示垃圾。
How can i show any language text in my label? 如何在标签中显示任何语言文字? I am using c# & mvc
我正在使用c#&mvc
Thanks. 谢谢。
If you use google fonts, When choosing the font there is an option: Choose the character sets you want , There you can choose characters for Japanese or other languages. 如果您使用谷歌字体,选择字体时有一个选项:选择您想要的字符集,在那里您可以选择日语或其他语言的字符。 This is how i handled the same issue in my project.
这就是我在项目中处理同样问题的方法。
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
Try one thing: Don't put it from db, try a plain Bengali/Japanese text as your title and see if shows correctly or not. 尝试一件事:不要把它从数据库中删除,尝试使用简单的孟加拉文/日文文本作为标题,看看是否正确显示。
if it shows correctly, then the problem is related to your database:
See what character encoding is set for your columns/table from which you are trying to pull data from. 查看为您从中尝试从中提取数据的列/表设置的字符编码。 if it is not set to support utf-8 then you make sure that it supports.
如果它没有设置为支持utf-8,那么你确保它支持。
define the relevant table as utf8 + collation utf8_bin. 将相关表定义为utf8 + collation utf8_bin。
c) if it is set to utf-8 but still you are seeing this problem then it is due to the fact that you are pulling data without setting character set encoding in your connection string. c)如果它被设置为utf-8但你仍然看到这个问题,那么这是因为你在没有在连接字符串中设置字符集编码的情况下提取数据。
OK, so for C# client to read & write unicode values, you must include in the connection string: charset=utf8 好的,所以对于C#客户端读取和写入unicode值,必须包含在连接字符串中:charset = utf8
for example: server=mysqlserver;user id=user;password=yourpassword;database=db123;charset=utf8; 例如:server = mysqlserver; user id = user; password = yourpassword; database = db123; charset = utf8;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.