如何确定Excel文件的字符编码? [英] How can I determine the character encoding of an excel file?

查看:225
本文介绍了如何确定Excel文件的字符编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

Excel到CSV与UTF8编码

场景:我有一个包含大量全球客户数据的excel文件。我不知道创建文件时使用了什么编码。

Scenario: I have an excel file containing a large amount of global customer data. I do not know what encoding was used when the file was created.

问题:如何确定excel文件中使用的字符编码,以便正确导入另一件软件?

Question: How can I determine the character encoding used in the excel file so I can import it correctly into another piece of software?

推荐答案

对于Excel 2010,应该是UTF-8。 MS说明:

http://msdn.microsoft.com/ en-us / library / bb507946

For Excel 2010 it should be UTF-8. Instruction by MS :
http://msdn.microsoft.com/en-us/library/bb507946:

SpreadsheetML文档的基本文档结构由Sheet和Sheet元素组成,它们引用了Workbook。为每个Worksheet创建一个单独的XML文件,例如,一个名为MySheet1和MySheet2的两个工作表的工作簿的SpreadsheetML位于Workbook.xml文件中,如下所示:

"The basic document structure of a SpreadsheetML document consists of the Sheets and Sheet elements, which reference the worksheets in the Workbook. A separate XML file is created for each Worksheet. For example, the SpreadsheetML for a workbook that has two worksheets name MySheet1 and MySheet2 is located in the Workbook.xml file and is shown in the following code example.

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
<workbook xmlns=http://schemas.openxmlformats.org/spreadsheetml/2006/main xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
    <sheets>
        <sheet name="MySheet1" sheetId="1" r:id="rId1" /> 
        <sheet name="MySheet2" sheetId="2" r:id="rId2" /> 
    </sheets>
</workbook>

工作表XML文件包含一个或多个块级元素,如SheetData。 sheetData表示单元格表,并包含一个或多个Row元素。行包含一个或多个单元格元素。每个单元格包含表示单元格值的CellValue元素。例如,工作簿中第一个工作表的SpreadsheetML(仅在单元格A1中的值为100)位于Sheet1.xml文件中,并显示在以下代码示例中。

The worksheet XML files contain one or more block level elements such as SheetData. sheetData represents the cell table and contains one or more Row elements. A row contains one or more Cell elements. Each cell contains a CellValue element that represents the value of the cell. For example, the SpreadsheetML for the first worksheet in a workbook, that only has the value 100 in cell A1, is located in the Sheet1.xml file and is shown in the following code example.

<?xml version="1.0" encoding="UTF-8" ?> 
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
    <sheetData>
        <row r="1">
            <c r="A1">
                <v>100</v> 
            </c>
        </row>
    </sheetData>
</worksheet>

检测单元格编码:

https:// metacpan。 org / pod / Spreadsheet :: ParseExcel :: Cell

http://forums.asp.net/t/1608228.aspx/1

这篇关于如何确定Excel文件的字符编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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