0

Hi Fellow drupal experts,

I have a problem, I developed a custom page intended to do a drupal json output :

and here is the code : function blogpull_menu() {

$items = array();

$items['blogpull'] = array(
    'page callback' => 'blogpull_view',
    'delivery callback' => 'drupal_json_output',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
);
return $items;

}

function blogpull_view() { global $base_url; global $language; $query = new EntityFieldQuery(); $query->entityCondition('entity_type', 'node') ->entityCondition('bundle', 'blog') ->propertyCondition('status', 1) ->propertyCondition('language', $language->language, '=') // filter by current language ->range(0, 5) ->addMetaData('account', user_load(1)); // Run the query as user 1. $result = $query->execute(); if (isset($result['node'])) { $blog_items_nids = array_keys($result['node']); $blog_items = entity_load('node', $blog_items_nids); }

foreach ($blog_items as $key => $blog_item) {
    $arr = array('date' => date('M. j, Y', $blog_items[$key]->created), 'title' => $blog_items[$key]->title, 'description' => $blog_items[$key]->body['und'][0]['value'], 'href' => $base_url.'/node/'.$blog_items[$key]->nid);
    $arrs[] = $arr;
}

return $arrs;

}

and some how when it's loading the japanese language it is showing this strange characters : クラウドゲーム事業ã®æ–°ä¼šç¤¾ã€Œã‚·ãƒ³ãƒ©ãƒ»ãƒ†ã‚¯ãƒŽãƒ­ã‚¸ãƒ¼ã€ç™ºè¶³

I tied using utf-encoding, mb_encoding and so on but nothing happen

can someone help?

thank you!

0

just check HTTP response headers it should have utf-8 charset.

  • the page just throw out nothing without the headers, I tried adding drupal_add_headers into it but still not working – Boby Sep 25 '14 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.