Skip to main content

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

  • February 4, 2015
  • 1 reply
  • 11 views

Kathleen_Chua
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?

1 reply

sudhir_1
Forum|alt.badge.img
  • Participating Frequently
  • February 4, 2015
"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