[rt-devel] Re: RT 2.0.60 / Data migration : Translation and code page issues ....

Robert Spier rspier at pobox.com
Fri Jan 24 23:42:01 EST 2003


> I tried your patch, and it had some strange effects.
> 
> On a database loaded from a dumpfile previously converted to UTF8 with iconv
> (which is a BAD idea anyway, as discussed in an other thread), it seems to
> work.

Interesting, because my tests this evening show that it probably won't
work, because it escapes things but doesn't unescape them.  What
database are you using?  

> But on a database loaded from a raw RT2 dumpfile (ie, full of latin1 accented
> caracters in my case), it crashes with the following message. I feel it
> wrongly identifies some latin1 single byte caracters as UTF8 two bytes
> caracters.
> Loading an RT3 instance with Latin1 strings should not be done, so maybe this
> "bug" is acceptable

I agree.  There's not much that can be done about this.  If we can't
put data through an arbitrary regex, the data is wrong.

Anyway, here's a new patchset to help with this quoting issue and a
related search issue.

Jesse, please confirm receipt.

-R

--- Tickets_Overlay_SQL.pm	2003-01-15 20:22:20-08	1.3
+++ Tickets_Overlay_SQL.pm	2003-01-24 20:34:15-08
@@ -170,6 +170,10 @@
         substr($val,-1,1) = "";
       }
 
+      # Unescape escaped characters
+      $key =~ s!\\(.)!$1!g;
+      $val =~ s!\\(.)!$1!g;
+
       #    print "$ea Key=[$key] op=[$op]  val=[$val]\n";
 
       my $class;
@@ -289,7 +293,8 @@
 
   # set SB's dirty flag
   $self->{'must_redo_search'} = 1;
-
+  $self->{'RecalcTicketLimits'} = 0;
+  $self;
 }
 
 

--- Tickets_Overlay.pm	2003-01-15 22:43:38-08	1.6
+++ Tickets_Overlay.pm	2003-01-24 20:32:17-08
@@ -1907,6 +1907,10 @@
       }
       exists $clause{$field} or $clause{$field} = [];
 
+      # Escape Quotes
+      $field =~ s!(['"])!\\$1!g;
+      $value =~ s!(['"])!\\$1!g;
+
       my $data = [ $ea, $type, $field, $op, $value ];
 
       # here is where we store extra data, say if it's a keyword or
@@ -1921,7 +1925,6 @@
 
     $self->FromSQL($sql);
 
-    $self->{'RecalcTicketLimits'} = 0;
 }
 
 



More information about the Rt-devel mailing list