doutan4831 2016-07-26 07:05
浏览 28

如何使用php com将unicode数据导出到word文档中

I am exporting unicode data using Php COM. I have written in top of my web page the below line:

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

But when I export the unicode data into a word document using Php COM, It is not coming properly like a unicode, Instood it is coming as shown below:

ಆದಿಯಲà³à²²à²¿ ದೇವರೠಆಕಾಶವನà³à²¨à³

I use the Php COM code to export the data to word document as below:

$unicode_data = "ಆದಿಯಲ್ಲಿ";
$word = new variant(com_get_active_object("word.application"));
$word->Selection->TypeText($unicode_data);

So please suggest me what else should be included to above code to get a unicode in correct format in the word document.

(From comment)

CREATE TABLE kan (
    id int(15) NOT NULL AUTO_INCREMENT, 
    content text CHARACTER SET utf8 NOT NULL, 
    PRIMARY KEY (id)
) ENGINE=MyISAM AUTO_INCREMENT=31105 DEFAULT CHARSET=latin1
  • 写回答

1条回答 默认 最新

  • dongrou2920 2016-07-27 01:01
    关注

    You wanted some Kannada text like 'ಆದಿಯಲ...'?

    You should not have to mention "unicode" anywhere.

    Your 'meta' and connection look correct.

    Please go to Trouble with utf8 characters; what I see is not what I stored and look at the recommended SELECT .. HEX. Does the hex look something like this (but without spaces)?

    E0B286 E0B2A6 E0B2BF E0B2AF
    

    If so, it was stored correctly. If not, then you have "double encoding" and the hex will be more like

    C3A0 C2B2 E280A0 C3A0 C2B2 C2A6 C3A0 C2B2
    

    utf8 E0B286 is Unicode 3206=x0C86 representing [ಆ] KANNADA LETTER AA

    评论

报告相同问题?

悬赏问题

  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)