dongxi2014 2013-07-17 11:44
浏览 34

问题解析CSV与德国字符到PHP

**$csv_data[] =  iconv('UTF-8', 'ASCII//TRANSLIT', utf8_encode(fgets($csvfile, 1024)));**

This is what I am doing to get the input data while parsing a csv. My CSV is UTF -8 .

I tried to figure out how to print exact parsing data to php but no luck yet so far

my input is Stöckl from CSV but I get St~APckl in PHP even after the utf8 encode.

Just to let you know I am trying to get German Characters in php variable.

Any help would be greatly appreciated

Solution -

This is what fixed my problem -

header('Content-type: text/html; charset=utf-8');

and I've changed

$csv_data[] =  iconv('UTF-8', 'ASCII//TRANSLIT', utf8_encode(fgets($csvfile, 1024)));

to

$csv_data[] = fgets($csvfile, 1024);
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
    • ¥15 帮我写一个c++工程
    • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
    • ¥15 关于smbclient 库的使用
    • ¥15 微信小程序协议怎么写
    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启