Error saving strings containing UTF-8 in to exposed columns
Normal behaviour when saving objects in classes with exposed columns is to truncate the value if the content is longer than the length of the exposed column.
The complete content is still saved in the BLOB, so user can still see the complete content when retrieved.
However, when the string contains UTF-8 characters, if it is longer than the exposed column, an error is returned.
Get different errors for different databases. This is for Oracle:
Fail: ORA-12899: value too large for column
Steps to Reproduce
1.Create a data class with a Text property. Define a local store for the class, so a table with exposed columns gets created.
2.Create a test activity:
a. Create a new Page.
b.Set the property with the exposed column.
c.Obj-save and Commit.
Following are the two cases:
- When the property has UTF-8 characters, you get error: Status fail Message Fail: ORA-12899: value too large for column
- When the property has no UTF-8 characters, it can be as long as you want, following Warning message opens:
The root cause of this problem is defect/misconfiguration in the operating environment.
The database column is defined in bytes but the data being stored is multi-byte characters, so the number of characters that can fit is less than the column length. Hence have advised to use Character length on the column rather than the Bytes. For Eg: In ORACLe use VARCHAR2 (256 CHAR) or NVARCHAR2 (256) compared to VARCHAR2 (256).
The explanation for this behavior is as follows:
The error is thrown because DB column is defined to use BYTE storage while data being stored uses multi-byte character set.
It is recommended to use Character type storage.
0% found this useful