如何使用PhoneGap的FileWriter的时候以BOM开始 [英] How to begin with a BOM when using the PhoneGap FileWriter

查看:235
本文介绍了如何使用PhoneGap的FileWriter的时候以BOM开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着写与PhoneGap的FileWriter的* .csv文件。它工作正常,输出是正确格式化为UTF-8。问题是,Excel等一些读者期待一个BOM(字节顺序标记)来检测UTF-8。

I try to write a *.csv file with the PhoneGap FileWriter. It works fine and the output is correct formated in UTF-8. The problem is that some reader like Excel expect a BOM (byte-order-marker) to detect UTF-8.

我怎么能在我的文件的开头添加此BOM?

How could I add this BOM at the beginning of my file?

推荐答案

我开始

writer.write("\uFEFF");

这是记录在这里:
http://www.ecma-international.org/ecma-262/5.1/

它的工作原理!

这篇关于如何使用PhoneGap的FileWriter的时候以BOM开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆