cross
New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists
This question about Using an extension: Asked

SqlPlugin: Accessing mysql-tables with utf-8 encoding

Hi,

when accessing a database table encoded with utf8 sqlplugin output shows 'strange' characters.

To solve this I hardcoded mysql_enable_utf8 => 1 in foswiki/lib/Foswiki/Plugins/SqlPlugin/Connection.pm line 85 ff.

Is there a better solution?

...
my $db = DBI->connect(
 $this->{dsn},
 $this->{username},
 $this->{password},
 {
 PrintError => 0,
 mysql_enable_utf8 => 1,
 RaiseError => 1
 });
 

-- BertoldAltaner - 10 Dec 2015

It doesn't look like this extension has been updated for utf-8 yet. In addition to telling mysql that utf-8 is in use, you may also need to convert utf-8 strings read from the database into UNICODE by calling Foswiki::decode_utf8( $theUtf8data ), and send data TO mysql by using Foswiki::encode_utf8( $some-unicode-strings )

-- GeorgeClark - 11 Dec 2015
 

QuestionForm edit

Subject Using an extension
Extension SqlPlugin
Version Foswiki 2.0.3
Status Asked
Related Topics
Topic revision: r2 - 11 Dec 2015, GeorgeClark - This page was cached on 21 Mar 2018 - 05:59.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License