X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FUTF8Columns.pm;h=e6e6e51ad2b7afbbb7f2914d52466c83cf188f07;hb=f3e9f0106fd3a446938e1a981704278922fcab2d;hp=d55224b5d404658ce88556212596f37e9935325d;hpb=a786c4585f8e11878b20e541aca3a9dc752ce4b9;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/UTF8Columns.pm b/lib/DBIx/Class/UTF8Columns.pm index d55224b..e6e6e51 100644 --- a/lib/DBIx/Class/UTF8Columns.pm +++ b/lib/DBIx/Class/UTF8Columns.pm @@ -7,7 +7,7 @@ __PACKAGE__->mk_classdata( '_utf8_columns' ); =head1 NAME -DBIx::Class::UTF8Columns - Force UTF8 (Unicode) flag on columns +DBIx::Class::UTF8Columns - Force UTF8 (Unicode) flag on columns (DEPRECATED) =head1 SYNOPSIS @@ -23,9 +23,54 @@ DBIx::Class::UTF8Columns - Force UTF8 (Unicode) flag on columns =head1 DESCRIPTION -This module allows you to get columns data that have utf8 (Unicode) flag. +This module allows you to get and store utf8 (unicode) column data +in a database that does not natively support unicode. It ensures +that column data is correctly serialised as a byte stream when +stored and de-serialised to unicode strings on retrieval. -=head2 Warning + 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 continue using this module and do not want to receive +further warnings set the environmane variable C +to a true value. + +=head2 Warning - Module does not function properly on create/insert + +Recently (April 2010) a bug was found deep in the core of L +which affects any component attempting to perform encoding/decoding by +overloading L and +L. As a result of this problem +L sends the original column values +to the database, while L sends the +encoded values. L and L +are both affected by ths 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 +L +to further discuss your concerns with the team. + +=head2 Warning - Native Database Unicode Support + +If your database natively supports Unicode (as does SQLite with the +C connect flag, MySQL with C +connect flag or Postgres with the C connect flag), +then this component should B 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. + +=head2 Warning - Component Overloading Note that this module overloads L in a way that may prevent other components overloading the same method from working @@ -113,7 +158,8 @@ sub store_column { # override this if you want to force everything to be encoded/decoded sub _is_utf8_column { - return (shift->utf8_columns || {})->{shift @_}; + # my ($self, $col) = @_; + return ($_[0]->utf8_columns || {})->{$_[1]}; } =head1 AUTHORS