如何使用 LOAD DATA LOCAL INFILE 设置特殊字符 [英] How to set special character with LOAD DATA LOCAL INFILE

查看:155
本文介绍了如何使用 LOAD DATA LOCAL INFILE 设置特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 LOAD DATA LOCAL INFILE 查询在 SQL 中设置正确的特殊字符

How to set right special character in SQL with LOAD DATA LOCAL INFILE query

使用 LOAD DATA LOCAL INFILE 插入我的数据.少数特殊字符被替换

Inserting my data with LOAD DATA LOCAL INFILE. few special character are replace

Ee-ock-ee"和tweet"就是这种听起来像"文学作品的例子设备"

"Ee-ock-ee" and "tweet" are examples of this "sounds like" literary device"

?Ee-ock-ee?和?推特?是这种听起来像"文学的例子设备

?Ee-ock-ee? and ?tweet? are examples of this "sounds like" literary device

推荐答案

看起来像字符集问题.阅读有关 LOAD LOCAL DATA 选项的更多信息:MySQL 文档

Looks like a character set problem. Read more about the LOAD LOCAL DATA options: MySQL docs

示例:

服务器使用由character_set_database 系统变量来解释信息文件.SET NAMES 和 character_set_client 的设置不影响输入的解释.如果输入文件的内容使用与默认值不同的字符集,通常是最好使用指定文件的字符集字符集子句.二进制字符集指定no转换."

The server uses the character set indicated by the character_set_database system variable to interpret the information in the file. SET NAMES and the setting of character_set_client do not affect interpretation of input. If the contents of the input file use a character set that differs from the default, it is usually preferable to specify the character set of the file by using the CHARACTER SET clause. A character set of binary specifies "no conversion."

注意:无法加载使用 ucs2、utf16、utf16le 或 utf32 字符集的数据文件.

Note: It is not possible to load data files that use the ucs2, utf16, utf16le, or utf32 character set.

可能值得仔细检查文件是否以您认为的字符集保存!然后继续.

It may be worth double checking that the file is saved in the character set you think it is! Then continue.

-- Show all available character sets
SHOW CHARACTER SET;

LOAD LOCAL DATA INFILE 'course.txt' INTO TABLE Course
CHARACTER SET swe7
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
IGNORE 1 LINES;

这篇关于如何使用 LOAD DATA LOCAL INFILE 设置特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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