本文介绍了用库尔德字体存储数据MySQL吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我用Java开发了一个应用程序,使用户可以将数据存储在MySQL数据库中.每当我输入به‌رواری ده‌رچوون时,我都会得到??????.有什么办法可以解决?这项工作在明天之前完成是非常重要的……我从来没有遇到过这样的问题,现在我正在为库尔德斯坦的一家公司创建数据库应用程序,现在我的朋友问,它是否可以存储数据与他们的角色?心脏病发作!请帮忙!

Hi so I've made an application in java that lets the user to store data in a MySQL database. Whenever I enter this به‌رواری ده‌رچوون I just get ??????. Is there any way I can fix that? It's really important that this job is done before tomorrow... I've never faced a problem such as this, and now I'm creating a database app for a company in Kurdistan, and now my friend asked, well does it store data with their characters? Heart attack! Please help!

我正在使用XAMPP的本地计算机上使用PhpMyadmin

I'm using PhpMyadmin on a localhost computer using XAMPP

推荐答案

发生了什么事:

  • 您有utf8编码的数据(很好)
  • SET NAMES latin1有效(默认,但不正确)
  • 该列被声明为CHARACTER SET latin1(默认,但错误)
  • you had utf8-encoded data (good)
  • SET NAMES latin1 was in effect (default, but wrong)
  • the column was declared CHARACTER SET latin1 (default, but wrong)

当您INSERTed数据被转换为latin1时,它没有阿拉伯语(Kurdish/Farsi/etc)字符的值,因此用问号代替了它们.

As you INSERTed the data, it was converted to latin1, which does not have values for Arabic (Kurdish/Farsi/etc) characters, so question marks replaced them.

治愈方法(对于将来的INSERTs):

The cure (for future INSERTs):

  • utf8编码的数据(良好)
  • mysqli_set_charset('utf8')(或您的客户建立CHARACTER SET所需的任何内容)
  • 检查列和/或表的默认值是否为CHARACTER SET utf8
  • 如果要显示在网页上,则<meta...utf8>应该在顶部附近.
  • utf8-encoded data (good)
  • mysqli_set_charset('utf8') (or whatever your client needs for establishing the CHARACTER SET)
  • check that the column(s) and/or table default are CHARACTER SET utf8
  • If you are displaying on a web page, <meta...utf8> should be near the top.

上面的讨论是关于CHARACTER SET的字符编码.现在来了解COLLATION的技巧,该技巧用于比较和排序.

The discussion above is about CHARACTER SET, the encoding of characters. Now for a tip on COLLATION, which is used for comparing and sorting.

要再次检查数据是否正确存储,请执行SELECT col, HEX(col)....
ه‌رچوون应该回来D987E2808CD8B1DA86D988D988D986
utf8中的阿拉伯字符为D8xx或D9xx的十六进制.

To double check that the data is stored correctly, doSELECT col, HEX(col)....
ه‌رچوون should come back D987E2808CD8B1DA86D988D988D986
Arabic characters in utf8 have hex of D8xx or D9xx.

(utf8mb4utf8一样好;对于阿拉伯语也一样.)

(utf8mb4 works just as well as utf8; either works for Arabic.)

坏消息:插入并变成"???"的数据无法恢复.

Bad news: The data that was inserted and turned into '???' cannot be recovered.

这篇关于用库尔德字体存储数据MySQL吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 02:27