WordPress.org

Plugin Directory

Changeset 620761


Ignore:
Timestamp:
11/03/12 18:25:09 (18 months ago)
Author:
dllh
Message:

Posterous Importer: Don't fail silently when there's UTF-8 in the response.

Location:
posterous-importer/branches/v2api
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • posterous-importer/branches/v2api/posterous.php

    r526178 r620761  
    193193        } 
    194194 
    195         $sites = json_decode( $data['body'] ); 
     195        $body = $data['body']; 
     196        if ( seems_utf8( $body ) ) 
     197            $body = utf8_encode( $body ); 
     198 
     199        $sites = json_decode( $body ); 
    196200        if ( !is_array( $sites ) ) { 
    197201            printf( __METHOD__ . ": <em>%s</em><br />\n", __( 'Error loading JSON data' ) ); 
     
    268272 
    269273        $body = $data['body']; 
    270         $posts = json_decode( $body ); 
     274        if ( seems_utf8( $body ) ) 
     275            $body = utf8_encode( $body ); 
     276 
     277        $posts = json_decode( utf8_encode( $body ) ); 
    271278 
    272279        if ( !is_array( $posts ) ) { 
     
    11761183 
    11771184        $body = $data['body']; 
     1185        if ( seems_utf8( $body ) ) 
     1186            $body = utf8_encode( $body ); 
     1187 
    11781188        $categories = json_decode( $body ); 
    11791189 
     
    11961206         
    11971207                $body = $data['body']; 
    1198                 $links = json_decode( $body );           
     1208                if ( seems_utf8( $body ) ) 
     1209                    $body = utf8_encode( $body ); 
     1210 
     1211                $links = json_decode( $body ); 
    11991212                foreach ( $links as $link ) { 
    12001213                    $this->add_link( $link ); 
  • posterous-importer/branches/v2api/readme.txt

    r524279 r620761  
    2121== Changelog == 
    2222 
     23= 0.11 - 3rd Nov 2012 
     24* Better handling of UTF-8 in responses from the API. 
     25 
    2326= 0.10 - 26th Mar 2012 
    2427* Add hook to handle non-200 responses from Posterous. 
Note: See TracChangeset for help on using the changeset viewer.