Supported character sets?

128 views
Skip to first unread message

Gabriel

unread,
Mar 11, 2011, 7:52:39 AM3/11/11
to H2 Database
Hello everyone,

I am trying to find the supported character sets for H2. For example,
for Derby I found :

Quoted from Development Guides of Derby -
http://db.apache.org/derby/docs/10.6/devguide/cdevcollation.html
Derby supports a wide range of character sets and encodes all of the
character sets by using the Unicode support provided by the
java.lang.Character class in the Java Virtual Machine (JVM) in which
the Derby database runs. See the Java API documentation for the
java.lang.Character class for the exact level of Unicode Standard that
is supported.

and I need to find the same sort of info for H2, but I was unable to.
Can someone please tell me where this can be found?

Thank you,
Gabriel

Thomas Mueller

unread,
Mar 15, 2011, 3:59:51 PM3/15/11
to h2-da...@googlegroups.com
Hi,

It's exactly the same. H2 internally uses Unicode, and supports all
character encodings and character sets supported by the virtual
machine you use. See also

http://h2database.com/html/grammar.html#set_collation
http://h2database.com/html/datatypes.html#varchar_type

Regards,
Thomas

Gabriel Rossetti

unread,
Mar 16, 2011, 4:49:48 AM3/16/11
to h2-da...@googlegroups.com
Thanks Thomas!

Gabriel


--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.


Gabriel Rossetti

unread,
Mar 16, 2011, 5:44:52 AM3/16/11
to h2-da...@googlegroups.com
Just another question related, is UTF-8 used to store chars in the DB or Java's default UTF-16? This is important as it doubles the size of the DB (or cuts it in half, depends on how you look at it :-)). Is it possible to set/force H2 to use UTF-8 if that's not the default?

Thanks, regards,
Gabriel

Thomas Mueller

unread,
Mar 19, 2011, 5:31:16 AM3/19/11
to h2-da...@googlegroups.com
Hi,

An encoding very similar to UTF-8 is used (it's not UTF-8 exactly
however, as characters outside the "Basic Multilingual Plane" are
stored as surrogate pairs). Basically, ASCII characters 0-127 need 1
byte. It's very similar to the format Java uses (which is also not
exactly UTF-8). See also org.h2.store.Data.writeStringWithoutLength().

Regards,
Thomas

Reply all
Reply to author
Forward
0 new messages