【发布时间】:2014-10-18 12:20:48
【问题描述】:
我需要一些帮助来获取一个 MySQL 表来存储和输出以下语言的字符:
- 英文
- 法语
- 俄语
- 土耳其语
- 德语
这些是我在数据中所知道的语言。它还使用如下数学符号:
b ∈ A. 为每个 A ⊆ 定义 s(A):= supn≥0 r A (n) ? ∪ {0}。
我正在使用 htmlentities 对文本进行编码。上面的 ? 旨在显示为 ℕ。 当我查看 PhpMyAdmin 中的数据时,它会以这种方式显示。其他字符按预期编码。
表格设置为 utf8_unicode_ci,网站的所有方面都设置为 UTF-8(包括通过 .htaccess 文件、PHP 标头和元标记)。
请帮忙?
附加信息:
托管环境:
Linux, Apache
Mysql 5.5.38
PHP Version 5.4.4-14
连接字符串:
ini_set('default_charset', 'UTF-8');
$mysqli = new mysqli($DB_host , $DB_username, $DB_password);
$mysqli->set_charset("utf8");
$mysqli->select_db($DB_name);
显示创建表 mydatabase.mytable 输出:
CREATE TABLE `tablename` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`created` datetime NOT NULL,
`updated` datetime NOT NULL,
`product` int(11) NOT NULL,
`ppub` tinytext COLLATE utf8_unicode_ci NOT NULL,
`pubdate` date NOT NULL,
`numerous_other_tinytext_cols` tinytext COLLATE utf8_unicode_ci NOT NULL,
`numerous_other_tinytext_cols` tinytext COLLATE utf8_unicode_ci NOT NULL,
`text` text COLLATE utf8_unicode_ci NOT NULL,
`keywords` tinytext COLLATE utf8_unicode_ci NOT NULL,
`active` int(11) NOT NULL DEFAULT '1',
`orderid` int(11) NOT NULL,
`src` tinytext CHARACTER SET latin1 NOT NULL,
`views` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=17780 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
从 information_schema.SCHEMATA 输出中选择 DEFAULT_CHARACTER_SET_NAME:
DEFAULT_CHARACTER_SET_NAME
utf8 [->UTF-8 Unicode]
utf8mb4 [->UTF-8 Unicode]
使用的字体:
Arial
数据库中的文本示例:
Let <em>A</em> be a subset of the set of nonnegative integers ℕ ∪ {0}, and let <em>r</em><sub><em>A</em></sub> (<em>n</em>) be the number of representations of <em>n</em> ≥ 0 by the sum <em>a</em> + <em>b</em> with <em>a, b</em> ∈ <em>A</em>.
网页输出:
Let <em>A</em> be a subset of the set of nonnegative integers ? ∪ {0}, and let <em>r</em><sub><em>A</em></sub> (<em>n</em>) be the number of representations of <em>n</em> ≥ 0 by the sum <em>a</em> + <em>b</em> with <em>a, b</em> ∈ <em>A</em>.
变成了
令 A 是非负整数集合的子集 ? ∪ {0},令 rA (n) 为 a + b 与 a 之和,b ∈ A 的 n ≥ 0 的表示数。
【问题讨论】:
-
数据库的连接字符串是什么?
SHOW CREATE TABLE mydatabase.mytable和SELECT DEFAULT_CHARACTER_SET_NAME FROM information_schema.SCHEMATA说什么?您使用什么字体、浏览器和操作系统?最后,当您通过 DB 客户端查看数据库中的数据时,它的外观如何? -
嗨,卡罗尔,我在上面添加了一些信息。到目前为止检查的浏览器包括 Firefox、IE 11 和 Chrome。所有输出方式相同。
-
有趣的是,我注意到在我的手机上查看此主题时,ℕ 字符不会显示在此页面上。
标签: mysql character-encoding character collation