rlm_sql and UTF8 encoded strings

Alan DeKok aland at deployingradius.com
Fri May 8 14:26:33 CEST 2009

Stephan Jaeger wrote:
> I have a problem with german umlauts in Acct-(Multi-)Session-Id. RFC2866
> states that the string should be UTF8 encoded which it is. But the
> sql_escape_func of rlm_sql does not account for utf characters and
> iterates the string byte by byte. What approach would be best here?

  src/lib/print.c contains a function utf8_char.  It could be made
public, and used to do proper character checks on UTF-8 strings.

  However, we can't make this functionality the default in the SQL
module.  I would suggest making it optional in the SQL module:

	sql {
		utf8 = yes	# ALL characters in ALL tables are utf-8

  Then in sql_escape_func(), check for utf8, and use the utf8_char
function to skip ahead, instead of doing "str++"

  Alan DeKok.

More information about the Freeradius-Devel mailing list