Changeset 3036 in subversion
- Timestamp:
- Oct 12, 2009 12:06:33 PM (4 years ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 4 edited
-
CHANGELOG (modified) (1 diff)
-
program/include/rcube_shared.inc (modified) (2 diffs)
-
program/steps/mail/func.inc (modified) (1 diff)
-
program/steps/mail/headers.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/CHANGELOG
r3034 r3036 2 2 =========================== 3 3 4 - Fix IE issue with non-UTF-8 characters in AJAX response (#1486159) 4 5 - Partially fixed "empty body" issue by showing raw body of malformed message (#1486166) 5 6 - Fix importing/sending to email address with whitespace (#1486214) -
trunk/roundcubemail/program/include/rcube_shared.inc
r2927 r3036 555 555 } 556 556 557 558 557 /** 559 558 * A method to guess encoding of a string. … … 586 585 } 587 586 587 /** 588 * Removes non-unicode characters from input 589 * 590 * @param mixed $input String or array. 591 * @return string 592 */ 593 function rc_utf8_clean($input) 594 { 595 // handle input of type array 596 if (is_array($input)) { 597 foreach ($input as $idx => $val) 598 $input[$idx] = rc_utf8_clean($val); 599 return $input; 600 } 601 602 if (!is_string($input)) 603 return $input; 604 605 // iconv is 10x faster 606 if (function_exists('iconv')) 607 return iconv('UTF8', 'UTF8//IGNORE', $input); 608 609 $regexp = '/^('. 610 // '[\x00-\x7F]'. // UTF8-1 611 '|[\xC2-\xDF][\x80-\xBF]'. // UTF8-2 612 '|\xE0[\xA0-\xBF][\x80-\xBF]'. // UTF8-3 613 '|[\xE1-\xEC][\x80-\xBF][\x80-\xBF]'. // UTF8-3 614 '|\xED[\x80-\x9F][\x80-\xBF]'. // UTF8-3 615 '|[\xEE-\xEF][\x80-\xBF][\x80-\xBF]'. // UTF8-3 616 '|\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF]'. // UTF8-4 617 '|[\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF]'.// UTF8-4 618 '|\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF]'. // UTF8-4 619 ')$/'; 620 621 $seq = ''; 622 $out = ''; 623 624 for ($i = 0, $len = strlen($input)-1; $i < $len; $i++) { 625 $chr = $input[$i]; 626 $ord = ord($chr); 627 // 1-byte character 628 if ($ord <= 0x7F) { 629 if ($seq) 630 $out .= preg_match($regexp, $seq) ? $seq : ''; 631 $seq = ''; 632 $out .= $chr; 633 // first (or second) byte of multibyte sequence 634 } else if ($ord >= 0xC0) { 635 if (strlen($seq)>1) { 636 $out .= preg_match($regexp, $seq) ? $seq : ''; 637 $seq = ''; 638 } else if ($seq && ord($seq) < 0xC0) { 639 $seq = ''; 640 } 641 $seq .= $chr; 642 // next byte of multibyte sequence 643 } else if ($seq) { 644 $seq .= $chr; 645 } 646 } 647 648 if ($seq) 649 $out .= preg_match($regexp, $seq) ? $seq : ''; 650 651 return $out; 652 } 588 653 589 654 /** -
trunk/roundcubemail/program/steps/mail/func.inc
r3035 r3036 458 458 if ($header->flagged) 459 459 $a_msg_flags['flagged'] = 1; 460 460 461 if ($browser->ie) 462 $a_msg_cols = rc_utf8_clean($a_msg_cols); 463 461 464 $OUTPUT->command('add_message_row', 462 465 $header->uid, -
trunk/roundcubemail/program/steps/mail/headers.inc
r1766 r3036 25 25 if ($source) 26 26 { 27 $browser = new rcube_browser; 28 29 if ($browser->ie) 30 $source = rc_utf8_clean($source); 31 27 32 $source = htmlspecialchars(trim($source)); 28 33 $source = preg_replace('/\t/', ' ', $source);
Note: See TracChangeset
for help on using the changeset viewer.
