English 中文(简体)
为什么我要从 SQL Tables 获得 Unicode 值?
原标题:Why am I getting unicode values back from SQLTables?

我试图通过 ODBC 将Ubuntu 上运行的 Python 程序从一个 Python 程序连接到同一机器上的 MySQL 框。 (I m 使用 ODBC 而不是 DB- API, 因为我将使用不同的数据库引擎, 我想要一个一致的方式获取系统目录, 如 SQL Tables 。 )

但当我连接到 MySQL 数据库并运行 SQL Tables 时, 我得到第一排的这个:

(u U0067007aU005f0061U00690062U006c006cU006e0069U005f0067U00750061U006f0074U0061006dU00690074U006e006fU0063005fU00630063 , u , u U00750061U00680074U0067005fU006f0072U00700075 , u U00410054U004c0042 , u )

显然,这些是 Unicode 值,但看起来它们其实是用于非常高的代码点的,而且很肯定,我无法将它们编码成 ASCII。我所有的表格名应该是 ASCII 。

是否我错过了某种环境 或错失了某种环境 导致这个局面?

我的Odbc.ini是:

[ODBC Data Sources]
mu      = MySQL

[mu]
Description = MySQL Database Test
Driver = MySQL
Server = localhost
Database = ccc2
Port = 3306

我的口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服口服

[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/odbc/libmyodbc.so
FileUsage = 1
最佳回答

找到它了。 我需要指定Charset=UTF8 在我的连接参数, 类似 :

[ODBC Data Sources]
mu      = MySQL

[mu]
Description = MySQL Database Test
Driver = MySQL
Server = localhost
Database = ccc2
Port = 3306
Charset = UTF8
问题回答

暂无回答




相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签