1. 首页
  2. 考试认证
  3. 其它
  4. EncodingWithBom确保文本在Excel中正确显示的方法

EncodingWithBom确保文本在Excel中正确显示的方法

上传者: 2024-11-07 17:03:15上传 ZIP文件 355.93KB 热度 7次

EncodingWithBom:这是一个用于编码文本数据并在行首添加BOM(字节顺序标记)的工具(gem)。例如:

  • 代码示例Simple string'.set_encoding_and_add_bom 'UTF-16LE'

  • 结果:文本行将正确显示在Microsoft Windows Office Excel和其他表格查看工具中。

实例方法

  • .set_encoding_and_add_bom(encodign_to):为字符串设置编码并添加BOM。

  • .set_encoding_and_add_bom!(encodign_to):在原字符串上直接设置编码并添加BOM。

  • .add_bom!:直接在原字符串上添加BOM。

  • .set_encoding(encod):仅设置编码。

下载地址
用户评论