Changeset 778161
- Timestamp:
- 09/25/2013 07:05:20 AM (12 years ago)
- File:
-
- 1 edited
-
post-by-email/trunk/class-post-by-email.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
post-by-email/trunk/class-post-by-email.php
r778160 r778161 679 679 $content = trim( $content ); 680 680 681 // fix up special characters which get turned into unicode and destroy everything 682 // via http://stackoverflow.com/questions/12007613/devilish-curly-quotes 683 684 // First, replace UTF-8 characters. 685 $content = str_replace( 686 array( 687 "\xe2\x80\x98", 688 "\xe2\x80\x99", 689 "\xe2\x80\x9c", 690 "\xe2\x80\x9d", 691 "\xe2\x80\x93", 692 "\xe2\x80\x94", 693 "\xe2\x80\xa6", 694 ), 695 array( "'", "'", '"', '"', '-', '--', '...' ), 696 $content 697 ); 698 699 // Next, replace their Windows-1252 equivalents... and non-breaking spaces 700 $content = str_replace( 701 array( chr( 145 ), chr( 146 ), chr( 147 ), chr( 148 ), chr( 150 ), chr( 151 ), chr( 133 ), chr( 0xA0 ) ), 702 array( "'", "'", '"', '"', '-', '--', '...', ' ' ), 703 $content 704 ); 681 // encode to UTF-8; this fixes up unicode characters like smart quotes, accents, etc. 682 $charset = $body->getCharset(); 683 if ( 'iso-8859-1' == $charset ) { 684 $content = utf8_encode( $content ); 685 } elseif ( function_exists( 'iconv' ) ) { 686 $content = iconv( $charset, 'UTF-8', $content ); 687 } 705 688 706 689 return $content;
Note: See TracChangeset
for help on using the changeset viewer.