Changeset 10827
- Timestamp:
- 2005-11-02T15:50:56+13:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugins/EMAILPlug.pm
r10254 r10827 487 487 # assume hostnames are \.\w\- only, then might have a trailing '/.*' 488 488 # assume URI doesn't finish with a '.' 489 $text =~ s@((http|ftp|https)://[\w\-]+(\.[\w\-]+)*/?((&|\. )?[\w\?\=\-_/~]+)*(\#[\w\.\-_]*)?)@<a href=\"$1\">$1<\/a>@g;489 $text =~ s@((http|ftp|https)://[\w\-]+(\.[\w\-]+)*/?((&|\.|\%[a-f0-9]{2})?[\w\?\=\-_/~]+)*(\#[\w\.\-_]*)?)@<a href=\"$1\">$1<\/a>@gi; 490 490 491 491 … … 700 700 $return_text.="\n<p><hr><strong><<attachment>>"; 701 701 # add part info header 702 my $header_text ="<br>Type: $part_content_type<br>\n";702 my $header_text = "<br>Type: $part_content_type<br>\n"; 703 703 if ($filename ne "") { 704 $header_text .="Filename: $filename\n";704 $header_text .= "Filename: $filename\n"; 705 705 } 706 706 $header_text =~ s@_@\\_@g; 707 $return_text .=$header_text . "</strong></p>\n<p>\n";707 $return_text .= $header_text . "</strong></p>\n<p>\n"; 708 708 } 709 709 710 710 if ($part_content_type =~ m@text/@) 711 711 { 712 my $part_text= $self->text_from_part($message_part); 712 # $message_part includes the mime part headers 713 my $part_text = $self->text_from_part($message_part); 713 714 if ($part_content_type !~ m@text/(ht|x)ml@) { 714 715 $part_text = text_into_html($part_text); … … 864 865 865 866 my $type="text/plain"; # default, overridden from part header 866 my $charset= "ascii"; # default, overridden from part header867 my $charset=undef; # convert2unicode() will guess if necessary 867 868 868 869 if (! $part_header) { # no header argument was given. check the body … … 982 983 } 983 984 985 if (! defined $charset) { 986 # check if we have valid utf-8 987 if ($$textref =~ /^(?: [\0-\x7f] | # ascii 988 [\xc0-\xdf][\x80-\xbf] | # 2 byte utf-8 989 [\xe0-\xef][\x80-\xbf]{2} | # 3 byte 990 [\xf0-\xf7][\x80-\xbf]{3} | # 4 byte 991 [\xf8-\xfb][\x80-\xbf]{4} | # 5 byte 992 [\xfc-\xfd][\x80-\xbf]{5} | # 6 byte 993 )+ /x) { 994 $charset = "utf8"; 995 } 996 997 998 # default to latin 999 $charset = "iso_8859_1" if ! defined($charset); 1000 } 1001 984 1002 # first get our character encoding name in the right form. 985 $charset = "iso_8859_1" unless defined $charset;986 1003 $charset =~ tr/A-Z/a-z/; # lowercase 987 1004 $charset =~ s/\-/_/g;
Note:
See TracChangeset
for help on using the changeset viewer.