Index: trunk/phase3/includes/MimeMagic.php |
— | — | @@ -479,9 +479,17 @@ |
480 | 480 | */ |
481 | 481 | } |
482 | 482 | |
483 | | - if ( $xml_type ) { |
484 | | - if ( $xml_type !== "UTF-8" && $xml_type !== "ASCII" ) { |
485 | | - $head = iconv( $xml_type, "ASCII//IGNORE", $head ); |
| 483 | + if( $xml_type == 'UTF-16BE' || $xml_type == 'UTF-16LE' ) { |
| 484 | + // Quick and dirty fold down to ASCII! |
| 485 | + $pack = array( 'UTF-16BE' => 'n*', 'UTF-16LE' => 'v*' ); |
| 486 | + $chars = unpack( $pack[$xml_type], substr( $head, 2 ) ); |
| 487 | + $head = ''; |
| 488 | + foreach( $chars as $codepoint ) { |
| 489 | + if( $codepoint < 128 ) { |
| 490 | + $head .= chr( $codepoint ); |
| 491 | + } else { |
| 492 | + $head .= '?'; |
| 493 | + } |
486 | 494 | } |
487 | 495 | } |
488 | 496 | |