MySQL default charset

Stefan Winter stefan.winter at restena.lu
Fri Feb 17 13:45:35 CET 2012


Hello,

for the n'th time, I ran into character set problems, where our
database server is well-configured for UTF-8, but the libmysqlclient
on the FreeRADIUS server end is not.

I kept pulling my hair out on the question why e-accent characters
come in as latin1 ( 0xe9 ) instead of proper UTF-8.

In the end I figured: the version of libmysqlclient that I have
defaults (compile-time default of the library) to latin1.

The character set is not configurable in FreeRADIUS. After some
searching, I realised that I need a my.cnf with some magic words
in /etc.

I wonder if either FreeRADIUS should make the charset configurable
in the sql/mysql/dialup.conf (my MySQL gurus say that it should
better be) - or at least this caveat should be documented.

Since the latter is just a config change, a diff -u to that end
is below.

Greetings,

Stefan Winter

diff -u dialup.conf dialup.conf.new 
--- dialup.conf 2011-09-30 16:12:07.000000000 +0200
+++ dialup.conf.new     2012-02-17 13:43:15.946237891 +0100
@@ -10,6 +10,17 @@
        #safe-characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /"
 
        #######################################################################
+        #  Connection config
+        #######################################################################
+        # The character set is not configurable. The default character set of
+        # the mysql client library is used. To control the character set,
+        # create/edit my.cnf (typically in /etc/mysql/my.cnf or /etc/my.cnf)
+        # and enter
+        # [client]
+        # default-character-set           = utf8
+        #
+
+       #######################################################################
        #  Query config:  Username
        #######################################################################
        # This is the username that will get substituted, escaped, and added
-- 
Stefan WINTER
Ingenieur de Recherche
Fondation RESTENA - Réseau Téléinformatique de l'Education Nationale et de la Recherche
6, rue Richard Coudenhove-Kalergi
L-1359 Luxembourg

Tel: +352 424409 1
Fax: +352 422473



More information about the Freeradius-Devel mailing list