Index: wp-includes/wp-db.php
===================================================================
--- wp-includes/wp-db.php	(revision 20795)
+++ wp-includes/wp-db.php	(working copy)
@@ -1127,6 +1127,17 @@
 			}
 
 			@mysql_free_result( $this->result );
+			
+			if ( function_exists( 'mb_convert_encoding' ) && 'UTF-8' !== $this->get_php_encoding() ) {
+				foreach ( $this->last_result as $key => $row ) {
+					$i = 0;
+					foreach ($row as $col => $val ) {
+						if ( 'string' === $this->get_col_info('type', $i++) ) {
+							$this->last_result[$key]->$col = mb_convert_encoding( $val, 'UTF-8', $this->get_php_encoding() );
+						}
+					}
+				}
+			}
 
 			// Log number of rows the query returned
 			// and return number of rows selected
@@ -1602,4 +1613,56 @@
 	function db_version() {
 		return preg_replace( '/[^0-9.].*/', '', mysql_get_server_info( $this->dbh ) );
 	}
+	
+	/**
+	 * Get php's encoding type based on DB_CHARSET
+	 * 
+	 * @return string  the sanitized string
+	 *
+	 * @uses DB_CHARSET  set in wp-config.php to know which $encoding to use
+	 */
+	public function get_php_encoding() {
+		static $encoding;
+		if ( !isset( $encoding ) ) {
+			switch ( strtolower( DB_CHARSET ) ) {
+				case 'latin1':
+					$encoding = 'ISO-8859-1';
+					break;
+				case 'utf8':
+				case 'utf8mb4':
+					$encoding = 'UTF-8';
+					break;
+				case 'cp866':
+					$encoding = 'cp866';
+					break;
+				case 'cp1251':
+					$encoding = 'cp1251';
+					break;
+				case 'koi8r':
+					$encoding = 'KOI8-R';
+					break;
+				case 'big5':
+					$encoding = 'BIG5';
+					break;
+				case 'gb2312':
+					$encoding = 'GB2312';
+					break;
+				case 'sjis':
+					$encoding = 'Shift_JIS';
+					break;
+				case 'ujis':
+					$encoding = 'EUC-JP';
+					break;
+				case 'macroman':
+					$encoding = 'MacRoman';
+					break;
+				default:
+					$encoding = 'UTF-8';
+					if ( WP_DEBUG ) {
+						trigger_error("Your DB_CHARSET doesn't map to a PHP encoding.", E_USER_WARNING);
+					}
+			}
+		}
+		return $encoding;
+	}
 }
