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.
Quote Reply
Re: [Robert] UTF8 - SET NAMES for mysql In reply to
Hi,

It would be nice if GLinks worked a bit nicer with UTF8, but it seems they are not going to do an update to it, for backwards compatibility (personally, I think they should just release a UTF8 friendly version, which doesn't care about old versions - and then its up to people to use it only on fresh installs, like yourself)

I had a problem recently with a french site I was working on - ended up having to do binmode(STDOUT, ":utf8"); , so force it to output some parts in UTF8.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] UTF8 - SET NAMES for mysql In reply to
I have encoded every global that is passed.
But for shure it would be nice to send this order to mysql bevor every query to save the encoding in globals.