我将数据存储在AWS RDS表source
中。该表包含一些汉字。
如何配置我的AWS粘合,以便它正确地将表中的数据复制到另一个表dest
中?
我已经告诉JDBC使用UTF-8编码。
如果我在python脚本中打印表的内容,则会得到以下文本:
\u4e8c\u578b\u7cd6\u5c3f\u75c5
以上文字的原始数据为6个汉字。
但是文本似乎不是UTF-8编码的字符串。因为我无法使用this online tool正确解码它们。
这是我用来打印文本的代码:
AWS胶粘作业完成后,目标表dest
中的数据变为?????
,这是不正确的。
以下python 2脚本可以在表格中正确打印汉字。
#!/usr/bin/python
import MySQLdb
db = MySQLdb.connect(host="remoteHost", # your host, usually localhost
user="myName", # your username
passwd="myPassword", # your password
db="jonhydb") # name of the data base
# you must create a Cursor object. It will let
# you execute all the queries you need
cur = db.cursor()
# Use all the SQL you like
cur.execute("SELECT * FROM source")
# print all the first cell of all the rows
for row in cur.fetchall():
print row[0]
db.close()
AWS胶和上面的代码是否使用不同的机制与MySQL数据库通信?
任何人都知道在使用AWS胶水时如何处理字符编码问题?