WordPress.org

Make WordPress Core

Ticket #1955: trackback.patch

File trackback.patch, 1.5 KB (added by drssay, 9 years ago)
  • wp-trackback.php

    old new  
    66} 
    77 
    88function trackback_response($error = 0, $error_message = '') { 
    9         header('Content-Type: text/xml; charset=' . get_option('blog_charset') ); 
     9        header('Content-Type: text/xml; charset=utf-8' ); 
    1010        if ($error) { 
    1111                echo '<?xml version="1.0" encoding="utf-8"?'.">\n"; 
    1212                echo "<response>\n"; 
     
    3434$title     = $_POST['title']; 
    3535$excerpt   = $_POST['excerpt']; 
    3636$blog_name = $_POST['blog_name']; 
    37 $charset   = $_POST['charset']; 
     37$headers = apache_request_headers(); 
     38$charset = substr (stristr ($headers['Content-Type'], 'charset='), 8); 
    3839 
    39 if ($charset) 
     40if ($charset) { 
    4041        $charset = strtoupper( trim($charset) ); 
    41 else 
     42} else 
    4243        $charset = 'ASCII, UTF-8, ISO-8859-1, JIS, EUC-JP, SJIS'; 
    4344 
    4445if ( function_exists('mb_convert_encoding') ) { // For international trackbacks 
    4546        $title     = mb_convert_encoding($title, get_settings('blog_charset'), $charset); 
    4647        $excerpt   = mb_convert_encoding($excerpt, get_settings('blog_charset'), $charset); 
    4748        $blog_name = mb_convert_encoding($blog_name, get_settings('blog_charset'), $charset); 
     49} else if ( function_exists('iconv') ) { 
     50        $title = iconv($charset, get_settings('blog_charset'), $title); 
     51        $excerpt = iconv($charset, get_settings('blog_charset'), $excerpt); 
     52        $blog_name = iconv($charset, get_settings('blog_charset'), $blog_name); 
    4853} 
    4954 
    5055if ( is_single() || is_page() )