Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

UTF8 - SET NAMES for mysql

Quote Reply
UTF8 - SET NAMES for mysql
While changing the whole page to UTF8 including the database and all tables i still have a problem, while the texts used for building are still in the wrong format. So i had to make a global for every tag like

my $lala = Tag
utf:encode $lala
return $lala

With this i have a clean site in utf8.

But i dont like to encode all the data before passing it to the templates.

In the driver for postgres i found:

Code:
sub connect {
my $self = shift;
my $dbh = $self->SUPER::connect(@_) or return;

# This is really a hack to get things working somewhat accurately - ideally
# all data should be in UTF8, but GT::SQL and our products do not yet have
# any provision for such, and inserting iso8859-1 data into a unicode table
# causes fatal errors about invalid utf8 sequences. So, we set it to
# latin1 here in the hopes that it won't break too much, and let the
# application deal with it. There are still inherent problems here,
# however - if the database is latin5, for example, setting this to latin1
# would make postgresql attempt to convert from latin1 -> latin5 on input
# and convert back on output, which is a potentially lossy conversion.
$dbh->do("SET NAMES 'LATIN1'");

return $dbh;
}

Unfortunatley there is now connect-function in the driver for mysql where i can do the same.
But i am shure there should be one place in my scripts where i can send this to mysql, but i dont know where.

I hope someone knows this place and will be kind to write it here.
Thank you.
Subject Author Views Date
Thread UTF8 - SET NAMES for mysql Robert 15725 May 16, 2014, 12:48 PM
Thread Re: [Robert] UTF8 - SET NAMES for mysql
Andy 15301 May 16, 2014, 11:41 PM
Post Re: [Andy] UTF8 - SET NAMES for mysql
Robert 15238 May 19, 2014, 9:13 AM