Unicode 电子表格到 MySQL
我正在尝试从 Excel 或 OpenOffice 获取包含 UTF 16 字符的文档到 MySQL,但我找不到导出该文档以便 phpmyadmin 读取它的最佳方法。我可以从 NeoOffice 导出为“unicode”格式,但 MySQL 中最接近的选项是 ucs2。当我尝试这种格式时,它只是旋转和思考。 UTF8 不支持我需要的所有字符。
I am trying to get a document from Excel or OpenOffice that contains UTF 16 characters into MySQL, but I can't find the best way to export the document so that phpmyadmin will read it. I can export out of NeoOffice as "unicode" format, but the closest option in MySQL is ucs2. When I try that format, it just spins and thinks. UTF8 doesn't support all the characters that I am needing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
UTF8确实支持UTF16的所有字符,只是UTF16将所有内容都塞进2个字节,而UTF8最多可以占用4个字节。
MySQL 目前不支持 UTF16,因为未指定编码的 endianness ,所以任何时候都不能保证正确性。 Mysql 6 应该支持 UTF16,但自从 6 开始使用冰,我不知道它发生了什么。
SQLite 默认支持 UTF16。
UTF8 does support all the characters of UTF16, it's just that UTF16 crams everything into 2 bytes, while UTF8 can take up to 4 bytes.
MySQL doesn't support UTF16 at this time, because the endianness of the encoding isn't specified, so correctness can't be guaranteed at any time. UTF16 was supposed to be supported for Mysql 6, but since 6 was put on ice, I have no idea what has happened with it.
SQLite supports UTF16 by default though.
另存为 UTF-8。如果您无法直接从 Office 软件另存为 UTF-8(天哪!),则加载到记事本或类似工具中并另存为 UTF-8。
作为 UTF,UTF-8 和 UTF-16 都可以表示所有 Unicode 字符的相同、完整范围。 UTF-8 是光盘上文件的合理编码; UTF-16LE(或“Unicode”,Windows 非常误导性地描述它)并非如此。 UTF-16 对于内存存储很有用,但 MySQL 不使用它。坚持使用 UTF-8 进行 MySQL 存储。
Save as UTF-8. If you can't save as UTF-8 directly from your Office software (oh dear!) then load into Notepad-or-similar and save out as UTF-8.
As UTFs, both UTF-8 and UTF-16 can represent the same, complete range of all Unicode characters. UTF-8 is a sensible encoding for files on disc; UTF-16LE (or “Unicode” as Windows very misleadingly describes it) isn't really. UTF-16 can be useful for in-memory storage, but MySQL doesn't use it. Stick with UTF-8 for MySQL storage.