支持 Unicode 数据的 SQLite 数据库 [英] SQLite database supporting Unicode data

查看:37
本文介绍了支持 Unicode 数据的 SQLite 数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用需要将 unicode 字符串拖入 jtable 的 java swing 应用程序.是否可以将 unicode 数据存储在 SQLITE 数据库中?如果是这样,哪个 SQLite 确实支持 unicode..我需要免费的 sqlite 而不是高级版..

I'm using java swing application which needs unicode string to drag into jtable.Is it possible to store unicode data in SQLITE database? If so,which SQLite does support unicode..I need free sqlite not the premium..

推荐答案

SQLite 始终将文本数据存储为 Unicode,使用创建数据库时指定的 Unicode 编码.数据库驱动程序本身负责将数据作为您的语言/平台使用的编码中的 Unicode 字符串返回.

SQLite always stores text data as Unicode, using the Unicode encoding specified when the database was created. The database driver itself takes care to return the data as the Unicode string in the encoding used by your language/platform.

如果您遇到转换问题,可能是您的应用程序尝试存储 ASCII 字符串而不将其转换为 Unicode,或者您尝试读取一个值并强制对其进行转换.

If you have conversion problems, either your application tried to store an ASCII string without converting it to Unicode, or you tried to read one value and force a conversion on it.

SQLite 使用一种动态类型,其中每个都使用特定的存储类.列的类型指定了 affinity 或如何处理值.例如:

SQLite uses a kind of dynamic typing, where each value is stored using a specific storage class. A column's type specifies the affinity or how the value is treated. For example:

具有 NUMERIC 关联的列可能包含使用所有五个存储类的值.将文本数据插入 NUMERIC 列时,文本的存储类会转换为 INTEGER 或 REAL

A column with NUMERIC affinity may contain values using all five storage classes. When text data is inserted into a NUMERIC column, the storage class of the text is converted to INTEGER or REAL

有五个存储类,NULL、INTEGER、REAL、TEXT、BLOB.TEXT 使用为数据库指定的 Unicode 编码(UTF-8、UTF-16BE 或 UTF-16LE)存储字符串数据.

There are five storage classes, NULL, INTEGER, REAL, TEXT, BLOB. TEXT stores string data using the Unicode encoding specified for the database (UTF-8, UTF-16BE or UTF-16LE).

您面临什么具体问题,或者这是一个普遍问题?

What specific problem are you facing, or is this a general question?

这篇关于支持 Unicode 数据的 SQLite 数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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