We are trying to save the line below, which is actually a name in db, we make some api call and get this name:
株式会社 エ ス · ダ ブ リ ュ ー · コ ミ ュ ニ ケ ー シ ョ ン ズ
When saving through our code (as in servlet-hibernate-database), we get an error message:
Caused by: java.sql.BatchUpdateException: ORA-12899: value too large for column "NAME_ON_ACCOUNT" (actual: 138, maximum: 100)
it's 23 characters, but it looks like it takes 6 bytes per character, which would make it only 138.
Below code gives me 69:
byte[] utf8Bytes = string.getBytes("UTF-8"); System.out.println(utf8Bytes.length);
And that gives me 92:
byte[] utf8Bytes = string.getBytes("UTF-32"); System.out.println(utf8Bytes.length);
I will definitely check the NLS_CHARACTERSET and look at the I / O classes, but have you ever seen a character with 6 bytes? Any help would be greatly appreciated.
source share