summaryrefslogtreecommitdiff
path: root/fml
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-03-26 11:41:08 +0000
committerfukachan <fukachan>2001-03-26 11:41:08 +0000
commit87ac82fb0efdd291ac8de20c2e6a33a7061c819c (patch)
treecec6ed12dd6e31595ca0a4b3cb2e135d14c4d61e /fml
parent617fb21dfdeb5a53b421376358e6babdef2ccd59 (diff)
downloadfml8-87ac82fb0efdd291ac8de20c2e6a33a7061c819c.tar.gz
fml8-87ac82fb0efdd291ac8de20c2e6a33a7061c819c.tar.bz2
fml8-87ac82fb0efdd291ac8de20c2e6a33a7061c819c.zip
preserve \s+ in the string to MIME encode
Diffstat (limited to 'fml')
-rw-r--r--fml/lib/FML/MIME.pm21
1 files changed, 21 insertions, 0 deletions
diff --git a/fml/lib/FML/MIME.pm b/fml/lib/FML/MIME.pm
index 75e15032..43af8322 100644
--- a/fml/lib/FML/MIME.pm
+++ b/fml/lib/FML/MIME.pm
@@ -86,6 +86,27 @@ by $options->{ charset }.
sub encode_mime_string
{
my ($str, $options) = @_;
+ my $buf = ''; # return buffer
+ my $p = 0;
+ my $pp = 0;
+
+ while ($str) {
+ if ($str =~ /^(\S+)/) {
+ $buf .= _encode_mime_string($1, $options);
+ $str =~ s/^(\S+)//;
+ }
+ elsif ($str =~ /^(\s+)/) {
+ $buf .= $1;
+ $str =~ s/^(\s+)//;
+ }
+ }
+
+ return $buf;
+}
+
+sub _encode_mime_string
+{
+ my ($str, $options) = @_;
my $charset = $options->{ 'charset' } || 'iso-2022-jp';
my $encode = $options->{ 'encode' } || 'base64';
my $header = '=?'. $charset;