8 my $schema = DBICTest->init_schema();
12 eval 'use Encode; 1' or plan skip_all => 'Need Encode run this test';
16 eval 'use utf8; 1' or plan skip_all => 'Need utf8 run this test';
21 DBICTest::Schema::CD->load_components('UTF8Columns');
22 DBICTest::Schema::CD->utf8_columns('title');
23 Class::C3->reinitialize();
25 my $cd = $schema->resultset('CD')->create( { artist => 1, title => 'øni', year => '2048' } );
26 my $utf8_char = 'uniuni';
29 ok( _is_utf8( $cd->title ), 'got title with utf8 flag' );
30 ok(! _is_utf8( $cd->year ), 'got year without utf8 flag' );
32 _force_utf8($utf8_char);
33 $cd->title($utf8_char);
34 ok(! _is_utf8( $cd->{_column_data}{title} ), 'store utf8-less chars' );
37 my $v_utf8 = "\x{219}";
39 $cd->update ({ title => $v_utf8 });
41 ok( !$cd->is_column_changed('title'), 'column is not dirty after setting the same unicode value' );
43 $cd->update ({ title => $v_utf8 });
44 $cd->title('something_else');
45 ok( $cd->is_column_changed('title'), 'column is dirty after setting to something completely different');
48 local $TODO = 'There is currently no way to propagate aliases to inflate_result()';
49 $cd = $schema->resultset('CD')->find ({ title => $v_utf8 }, { select => 'title', as => 'name' });
50 ok (_is_utf8( $cd->get_column ('name') ), 'utf8 flag propagates via as');
56 Encode::_utf8_on ($_[0]);
65 return Encode::is_utf8 (shift);
68 return utf8::is_utf8 (shift);