[wp-trac] Re: [WordPress Trac] #1955: Outgoing trackback ping could include 'charset' attribute for international trackbacks

WordPress Trac wp-trac at lists.automattic.com
Tue Sep 5 07:42:13 GMT 2006


#1955: Outgoing trackback ping could include 'charset' attribute for international
trackbacks
--------------------------------------------+-------------------------------
 Reporter:  matopc                          |        Owner:  anonymous
     Type:  enhancement                     |       Status:  new      
 Priority:  normal                          |    Milestone:  2.1      
Component:  Optimization                    |      Version:  2.0      
 Severity:  normal                          |   Resolution:           
 Keywords:  trackback charset bg|has-patch  |  
--------------------------------------------+-------------------------------
Changes (by Tae-young):

  * type:  defect => enhancement

Comment:

 * 'ASCII' is 100% compatible with 'UTF-8' so it will be better to remove
 'ASCII' from $charset;
  * I've never seen error in conversion string from 'iso8859-1' to 'utf-8'
 (or other) if the string was encoded with 'euc-kr' or whatever. I don't
 know how mb_convert_encoding works, but I think mb_convert_encoding will
 judge 'iso8859-1' is the appropriate encoding because there's no error in
 conversion 'iso8859-1' to any other encoding. How about move 'iso8859-1'
 to the end of $charset.
  * Why there's no Korean encoding like 'euc-kr', 'cp949' in $charset?
 (cp949 is compatible with euc-kr, and cp949 has every character in euc-kr,
 so it will be enough adding 'cp949' to $chraset)
  * For system which doesn't support mbstrings, how about using iconv if
 there not exist mbstring module.

 {{{
     if ($_POST['charset'])
         $charset = strtoupper( trim($_POST['charset']) );
     else
         $charset = 'UTF-8, EUC-KR, JIS, EUC-JP, SJIS, ISO-8859-1';

     $passed = array( 0, 0, 0 );
     if ( function_exists('mb_convert_encoding') ) {

         $title     = mb_convert_encoding($title,
 get_settings('blog_charset'), $charset);
         $excerpt   = mb_convert_encoding($excerpt,
 get_settings('blog_charset'), $charset);
         $blog_name = mb_convert_encoding($blog_name,
 get_settings('blog_charset'), $charset);
     }
     else if ( function_exists('iconv') ) {
         $charsets = explode( ', ', $charset  );

         for( $i = 0 ; $i < count($charsets); $i++ ){
             if ( !$passed[0] )
                 $passed[0] = iconv($charsets[$i],
 get_settings('blog_charset'), $title);
             if ( !$passed[1] )
                 $passed[1] = iconv($charsets[$i],
 get_settings('blog_charset'), $excerpt);
             if ( !$passed[2] )
                 $passed[2] = iconv($charsets[$i],
 get_settings('blog_charset'), $blog_name);
         }
         $title = $passed[0];
         $excerpt = $passed[1];
         $blog_name = $passed[2];

     }
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/1955>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list