Hsqldb table encoding

断了今生、忘了曾经 提交于 2019-12-02 11:19:15

问题


How do I set the character encoding for a specific table? E.g:

CREATE TABLE COMMENTS (
    ID INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 0, INCREMENT BY 1) NOT NULL,
    TXT LONGVARCHAR,
    PRIMARY KEY (ID)
)

By default it's encoded as ASCII but I'd rather use UTF-8 for this one table.


回答1:


Are you sure that it's encoded as ASCII by default? My reading of it was that it's UTF-8 by default, though I'm open to correction here.

If it's a TEXT table you'll can specify the encoding for the table

SET TABLE mytable SOURCE "myfile;encoding=UTF-8"



回答2:


HSQLDB certainly stores all data in Unicode (with the exception of TEXT tables where you have to specify UTF-8). Therefore you don't need to specify a character encoding for normal tables.




回答3:


The problem is that you must convert all rows before import.
To do this you must export the contents to a file and converter the file into utf-8. Then import it again with utf-8 options.

MyPHPadmin can import it with utf-8 options, (Remember to check for CHARSET=latin1 / latin1 in the file).

You can read more about to do it manually her: http://en.gentoo-wiki.com/wiki/Convert_latin1_to_UTF-8_in_MySQL



来源:https://stackoverflow.com/questions/845418/hsqldb-table-encoding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!