DBIx::C...Columns(3)
π NAME π
okay bestie, welcome to the DBIx::C...Columns(3) page β User Contributed Perl Documentation energy. This is DBIx::Class::UTF8Columns β Force UTF8 (Unicode) flag on columns. And yes, the DEPRECATED sticker is right there on the tin, no cap. π
β¨ SYNOPSIS β¨
package Artist;
use base 'DBIx::Class::Core';
__PACKAGE__->load_components(qw/UTF8Columns/);
__PACKAGE__->utf8_columns(qw/name description/);
# then belows return strings with utf8 flag
$artist->name;
$artist->get_column('description');
π¦ DESCRIPTION π¦
This module lets you get and store utf8 (unicode) column data in a database that does not natively support unicode. It makes sure column data is correctly serialised as a byte stream when it's stored and de-serialised back into unicode strings when it's retrieved. π«Ά
THE USE OF THIS MODULE (AND ITS COUSIN DBIx::Class::ForceUTF8 ) IS VERY STRONGLY DISCOURAGED, PLEASE READ THE WARNINGS BELOW FOR AN EXPLANATION.
If you want to keep using this module and do not want to receive further warnings, set the environment variable DBIC_UTF8COLUMNS_OK to a true value.
β οΈ Warning - Module does not function properly on create/insert β οΈ
Recently (April 2010) a bug was found deep in the core of DBIx::Class which affects any component attempting to perform encoding/decoding by overloading store_column and get_columns. As a result of this problem, create sends the original column values to the database, while update sends the encoded values. DBIx::Class::UTF8Columns and DBIx::Class::ForceUTF8 are both affected by this bug. π
It is unclear how this bug went undetected for so long (it was introduced in March 2006). No attempts to fix it will be made while the implications of changing such a fundamental behavior of DBIx::Class are being evaluated. However, in this day and age you should not be using this module anyway, as Unicode is properly supported by all major database engines, as explained below.
If you have specific questions about the integrity of your data in light of this development β please join us on IRC or the mailing list to further discuss your concerns with the team.
β οΈ Warning - Native Database Unicode Support β οΈ
If your database natively supports Unicode (as does SQLite with the sqlite_unicode connect flag, MySQL with mysql_enable_utf8 connect flag or Postgres with the pg_enable_utf8 connect flag), then this component should not be used, and will corrupt unicode data in a subtle and unexpected manner. π
It is far better to do Unicode support within the database if possible rather than converting data to and from raw bytes on every database round trip.
β οΈ Warning - Component Overloading β οΈ
Note that this module overloads store_column in DBIx::Class::Row in a way that may prevent other components overloading the same method from working correctly. This component must be the last one before DBIx::Class::Row (which is provided by DBIx::Class::Core). DBIx::Class will detect such incorrect component order and issue an appropriate warning, advising which components need to be loaded differently.
π SEE ALSO π
Template::Stash::ForceUTF8, DBIx::Class::UUIDColumns.
π οΈ METHODS π οΈ
utf8_columns
π§ͺ EXTENDED METHODS π§ͺ
get_columnget_columnsstore_column
π€ FURTHER QUESTIONS? π€
Check the list of additional DBIC resources.
π COPYRIGHT AND LICENSE π
This module is free software copyright by the DBIx::Class (DBIC) authors. You can redistribute it and/or modify it under the same terms as the DBIx::Class library.
π cute little sign-off: this iconic page is DBIx::C...Columns(3), shipped with perl v5.42.0, dated 2025-01-22. That's the footer tea, bestie. Periodt. π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: perl-DBIx-Class 0.082844-bp160.1.10 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms