diff --git a/handlers/views_handler_filter_string.inc b/handlers/views_handler_filter_string.inc
index cf7ac35..b8193d2 100644
--- a/handlers/views_handler_filter_string.inc
+++ b/handlers/views_handler_filter_string.inc
@@ -302,11 +302,12 @@ class views_handler_filter_string extends views_handler_filter {
   }
 
   function op_shorter($field, $upper) {
-    $this->query->add_where($this->options['group'], "LENGTH($upper($field)) < %d", $this->value);
+    $length = $this->query->get_sql_functon('LENGTH');
+    $this->query->add_where($this->options['group'], "$LENGTH($upper($field)) < %d", $this->value);
   }
 
   function op_longer($field, $upper) {
-    $this->query->add_where($this->options['group'], "LENGTH($upper($field)) > %d", $this->value);
+    $this->query->add_where($this->options['group'], "$LENGTH($upper($field)) > %d", $this->value);
   }
 
   function op_empty($field) {
diff --git a/plugins/views_plugin_query_default.inc b/plugins/views_plugin_query_default.inc
index 8029a3a..bdda8f0 100644
--- a/plugins/views_plugin_query_default.inc
+++ b/plugins/views_plugin_query_default.inc
@@ -1280,6 +1280,20 @@ class views_plugin_query_default extends views_plugin_query{
   }
 
   /**
+   * Convert a certain sql function to it's database specific type.
+   */
+  function get_sql_function($function) {
+    switch ($function) {
+      case 'LENGTH':
+        // Only mysql and pgsql is supported by default so let's return
+        // the mbyte specific version.
+        return 'CHAR_LENGTH';
+      default:
+        return $function;
+    }
+  }
+
+  /**
    * Return info to base the uniqueness of the result on.
    *
    * @return $cache_info
