From b5f22d7c0522a660bcc7ba7830e4a5d14f8654d5 Mon Sep 17 00:00:00 2001 From: Brian Lopez Date: Thu, 1 Apr 2010 14:45:58 -0700 Subject: [PATCH] check charsetnr flag as well --- ext/mysql2_ext.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/mysql2_ext.c b/ext/mysql2_ext.c index e357181..bfc95e1 100644 --- a/ext/mysql2_ext.c +++ b/ext/mysql2_ext.c @@ -191,7 +191,8 @@ static VALUE rb_mysql_result_fetch_row(int argc, VALUE * argv, VALUE self) { default: val = rb_str_new(row[i], fieldLengths[i]); #ifdef HAVE_RUBY_ENCODING_H - if (fields[i].flags & BINARY_FLAG) { + // rudimentary check for binary content + if ((fields[i].flags & BINARY_FLAG) || fields[i].charsetnr == 63) { rb_enc_associate_index(val, binaryEncoding); } else { rb_enc_associate_index(val, utf8Encoding);