簡體   English   中英

PHP函數無法識別其他語言

[英]PHP function not recognize different language

現在,當我從泰盧固語網站上獲取英語內容時,我已經從泰盧固語網站上抓取了數據,我可以毫無問題地獲取它,但是假設內容是泰盧固語(印度的泰米爾語)

網站網址

它不返回正確的字符串。

返回字符串

碼:

<?php

//
include "simple_html_dom.php";
// Get news from telugu site
$url = "http://www.123telugu.com/category/mnews";

$html = file_get_html($url);
$divs = $html->find('div.leading');
$result = array();
$status = FALSE;
$i = 0;
foreach ($divs as $d) {
    $status = TRUE;
    $title = $d->find('a', 0)->plaintext;
    $result[$i]['Title'] = $title;
    $link = $d->find('a', 0)->href;
    $result[$i]['Link'] = $link;
    $title = trim(mysql_real_escape_string($title));  // code for title
    $html = file_get_html($link);
    // code for image
    $image = '';
    foreach ($html->find('div.post-content') as $im) {
        $image = $im->find('img', 0)->src; // code for  image
    }
    $image = trim(str_replace('//', '', $image));
    $result[$i]['Image'] = $image;
    // code for content
    $content = '';
    foreach ($html->find('div.post-content p') as $co) {
        $content.= $co->plaintext;   // code for content
    }
    $result[$i]['Content'] = $content;
    $i++;
}

echo json_encode(array('Status' => $status, 'Data' => $result));

我已經在頁面頂部設置了內容類型utf-8,還在phpmyadmin( Url )中設置了字段的集合“ utf8_general_ci”,現在瀏覽器檢測到了語言( Url ),但是在此API在Android端調用時出現了問題。

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM