[rt-users] rt2 to rt3 1.17
Ruslan U. Zakirov
cubic at acronis.ru
Mon Jul 28 05:24:14 EDT 2003
Sorry for this patch. I don't exactly understand but it's breaking
convertion at all.
I don't understand why $data=decode($enc, $data) isn't same as
from_to($data,$enc,'utf8').
But decoding of attachment subject is still needed.
Best regards, Ruslan.
Ruslan U. Zakirov wrote:
> Hello, Jesse and other.
> This solve only content problem, but subject of attach have to be
> converted too.
> Ruslan.
> PS: Some other additions to re's don't break it. I want to speed up
> it, but then do benchmarks with perl 5.8.0 and understand that it's
> not issue.
> PSS: Unicode translation realy slow down importing, but it's better
> then absense of content in browser :)
>
> Jesse Vincent wrote:
>
>> Is now available. The big change from 1.16 is that it now converts
>> messages and attachments which had been stored in RT2's database into
>> UTF8 (Unicode) when moving to RT3. I'd be curious to know how folks who
>> were having trouble with 1.16 do with this version.
>>
>> Jesse
>
>------------------------------------------------------------------------
>
>diff -Nru v1.17/dumpfile-to-rt-3.0 v1.17-my/dumpfile-to-rt-3.0
>--- v1.17/dumpfile-to-rt-3.0 2003-07-25 09:21:08.000000000 +0400
>+++ v1.17-my/dumpfile-to-rt-3.0 2003-07-25 21:28:09.000000000 +0400
>@@ -597,25 +597,25 @@
>
> foreach my $a ( @{$attach} ) {
>
>- if ( $a->{'Headers'} =~ /^Content-Type: (.*?)$/m ) {
>+ if ( $a->{'Headers'} =~ /^Content-Type: (?:.*?)$/mo ) {
> my $content_type = $1;
>- if ( $content_type =~ qr{(text/plain|message/rfc822)}i ) {
>+ if ( $content_type =~ qr{(?:text/plain|message/rfc822)}i ) {
> my $enc;
> if ( $content_type =~
>- /charset=['"]?(.*?)(\s|\'|\"|;|$)/ )
>+ /charset=['"]?(.*?)(?:\s|\'|\"|;|$)/o )
> {
> $enc = $1;
> }
> else {
> $enc = $ENCODING; #DEFAULT;
> }
>- $enc =~ s/"'//gi;
>+ $enc =~ s/"'//go;
> $enc = lc($enc);
> unless ( $enc eq 'utf-8' || $enc eq 'utf8' ) {
> use Encode;
> eval {
>- Encode::from_to( $a->{'Content'},
>- $enc => 'utf8' );
>+ $a->{'Content'} = decode($enc, $a->{'Content'});
>+ $a->{'Subject'} = decode($enc, $a->{'Subject'});
> $a->{'Headers'} .=
> "X-RT-Original-Encoding: $enc\n";
> };
>@@ -623,8 +623,8 @@
> warn $@;
> eval {
> $enc = $ENCODING;
>- Encode::from_to( $a->{'Content'},
>- $enc => 'utf8' );
>+ $a->{'Content'} = decode($enc, $a->{'Content'});
>+ $a->{'Subject'} = decode($enc, $a->{'Subject'});
> $a->{'Headers'} .=
> "X-RT-Original-Encoding: $enc\n";
> };
>
>
More information about the rt-users
mailing list