Hsqldb table encryption

How do I customize the character encoding for a specific table? For instance:

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

It is encoded as ASCII by default, but I would rather use UTF-8 for this table.

+1


a source to share


3 answers


Are you sure it is ASCII encoded by default? I read that it is UTF-8 by default, although I am open to a fix here.

If it is a TEXT table, you can specify the encoding for the table



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

      

+1


a source


HSQLDB, of course, stores all data in Unicode (except for TEXT tables where you must specify UTF-8). Therefore, you do not need to specify the character encoding for regular tables.



+1


a source


The problem is that you have to convert all strings before importing.
To do this, you must export the content to a file and convert the file to utf-8. Then import it again using utf-8 parameters.

MyPHPadmin can import it using utf-8 options (remember to check CHARSET = latin1 / latin1 in the file).

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

0


a source







All Articles