对阿拉伯数据使用LOAD DATA INFILE [英] Using LOAD DATA INFILE with arabic data

查看:125
本文介绍了对阿拉伯数据使用LOAD DATA INFILE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将.csv文件导入表格。我已经想出如何通过使用以下查询插入数据:

I am trying to import a .csv file into a table. I have figured out how to get the data inserted by using the following query:

LOAD DATA INFILE 'examplesofdata.csv' INTO TABLE coins FIELDS TERMINATED BY ',' 
ENCLOSED BY '' ESCAPED BY '\\'  IGNORE 1 LINES;

然而,对于我的几个字段,我有阿拉伯语内容输入为一系列?我假设这是因为我没有正确地整理数据库或我不完全理解LOAD DATA INFILE查询。任何建议都非常感激。

However for several of my fields I have Arabic content which gets entered as a series of ? I assume this is because I haven't collated the database correctly or I don't fully understand the LOAD DATA INFILE query. Any advice would be greatly appreciated.

SHOW CREATE TABLE硬币;输出是:

The SHOW CREATE TABLE coins; output is:

CREATE TABLE `coins` (
  `cat_num` int(11) NOT NULL,
  `reg_num` int(11) NOT NULL,
  `period` varchar(255) NOT NULL,
  `arb_period` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL,
  `ruler` varchar(255) NOT NULL,
  `arb_ruler` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL,
  `mint` varchar(255) NOT NULL,
  `arb_mint` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL,
  `date` varchar(255) NOT NULL,
  `weight` float NOT NULL,
  `diameter` float NOT NULL,
  `khedieval_num` varchar(255) NOT NULL,
  `ref` text NOT NULL,
 PRIMARY KEY  (`cat_num`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8


推荐答案

所以我最终得到一个老教师的答案为我的数据库类。他告诉我,这个问题实际上是当前版本的MySQL报告的错误,并且当时唯一已知的解决方案是通过PHP或其他脚本语言手动导入数据。

So I ended up getting an answer from an old instructor for my Databases class. He told me that this problem is actually a reported bug with the current version of MySQL and that the only known solution at the time is to manually import the data through PHP or another scripting language.

此问题的错误位于: http://bugs.mysql。 com / bug.php?id = 10195

它没有帮助我太多,因为我只是在一个原型,并管理一个解决方法平均时间,但希望它可以更有用的你。

It didn't help me too much since I was only working on a prototype, and managed a workaround in the mean time, but hopefully it can be of more use to you.

这篇关于对阿拉伯数据使用LOAD DATA INFILE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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