dpwtr666638 2014-02-18 08:25
浏览 79

CSV文件保存印地语天城文字符获取,

I have a CSV file which contains words in english followed by Hindi words. I am trying to read the CSV file and do some further processing with it. The csv file looks like so:

Vice President-1    ????? ?????? ????
Vice President-2    ? ? ?
Vice President-3    ? ? ?
Secretary   ? ? ?

How to read this file in php with Hindi words i also insert that word in database , and retrive

move_uploaded_file($_FILES['file']['tmp_name'],$target_path);
$file = fopen("$target_path", "r");
while (($data = fgetcsv($file, 8000, ",")) !== FALSE) 
{
}
  • 写回答

1条回答 默认 最新

  • dongzongzi0379 2014-02-18 08:34
    关注

    I had a similar problem with hebrew and found out getcsv() functions don't work well with non english UTF-8.
    Here is my solution (parsing csv manually):

    $data = 'some csv string';  
    $data_arr = preg_split("/((?
    )|(
    ?))/", $data);  
    while ($line = array_shift($data_arr)) 
    {
        $row  = array();
        $line = preg_match_all('/"[^"]+"|[^,]+/', $line, $matches);
        $line = $matches[0];  
    //your code here  
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀