Inserting Japanese characters in UTF-8 encoding - Varchar limit exceeded.

I am running Vertica in JDBC with character encoding UTF-8. Let's say I have a table with Varchar(10), the problem is I cannot insert 4 Japanese characters in the table since 1 Japanese character takes up 3 bytes in UTF-8 encoding.

[Vertica][VJDBC](4800) ERROR: String of 12 octets is too long for type Varchar(10)

Is there any other way of inserting data by the number of characters and not the number of bytes?

Comments

  • "Tip: When specifying the maximum column width in a CREATE TABLE statement, use the width in bytes (octets) for any of the string types. Each UTF-8 character may require four bytes, but European languages generally require a little over one byte per character, while Oriental language generally require a little under three bytes per character."

    create table t(c varchar(12 byte)); 

    Thanks
    Sudhir

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file