6.0.0-beta1
▾
Tasks
New Task
Search
Photos
Wiki
▾
Tickets
New Ticket
Search
dev.horde.org
Toggle Alerts Log
Help
11/9/25
H
istory
A
ttachments
C
omment
W
atch
Download
Comment on [#1609] Incorrect encoding by MIME::encode() on some UTF-8 strings
*
Your Email Address
*
Spam protection
Enter the letters below:
.___. ..__ ._..___. [__ |_/ | \ | _/ | | \|__/_|_./__.
Comment
> While investigating a problem with the norwegian character "Å" (big > "å"), causing incorrectly encoded headers when sending mail with > UTF-8 (but not ISO-8859-1), i tracked it to line 142 in > lib/Horde/MIME.php: > > > > $size = preg_match_all('/([^\s]+)([\s]*)/', $text, $matches, PREG_SET_ORDER); > > > > In my case, adding the Unicode option (/u) to the regex solved the problem: > > > > $size = preg_match_all('/([^\s]+)([\s]*)/u', $text, $matches, > PREG_SET_ORDER); > > > > It seems preg_match_all does not always handle multibyte characters > (e.g. norwegian Å). On a system with PHP 4.3.10, Apache/1.3.33, and, > the bug appeared, as shown by this Amavis alert with "Åretur" as the > subject: > > > > X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char 85 hex) in > message header 'Subject' > > Subject: Re: =?utf-8?b?ww==?=\205retur\n > > > > A var_dump of $matches would show the mangled first character as the > first entry in the array, with "retur" in the second entry. > > > > On another system running PHP 4.3.9, Apache/1.3.31 the bug did NOT appear. > > > > I'm not sure whether this is a bug with other character sets, or > whether turning on multibyte character support in PHP would solve the > problem.
Attachment
Watch this ticket
N
ew Ticket
M
y Tickets
S
earch
Q
uery Builder
R
eports
Saved Queries
Open Bugs
Bugs waiting for Feedback
Open Bugs in Releases
Open Enhancements
Enhancements waiting for Feedback
Bugs with Patches
Enhancements with Patches
Release Showstoppers
Stalled Tickets
New Tickets
Horde 5 Showstoppers