相关疑难解决方法(0)

保存文件时Microsoft Excel使用什么字符集?

我有一个Java应用程序,它读取已在Excel中创建的CSV文件(例如2007).有谁知道MS Excel使用什么字符集来保存这些文件?

我猜对了:

  • windows-1255(Cp1255)
  • ISO-8859-1
  • UTF8

但我无法使用这些字符集类型解码扩展字符(例如法语强调字母).

excel encoding character-encoding

60
推荐指数
3
解决办法
12万
查看次数

UnicodeError: UTF-16 stream does not start with BOM

I have trouble reading the csv file by python. My csv file has Korean and numbers.

Below is my python code.

import csv
import codecs
csvreader = csv.reader(codecs.open('1.csv', 'rU', 'utf-16'))
for row in csvreader:
    print(row)
Run Code Online (Sandbox Code Playgroud)

First, there was a UnicodeDecodeError when I enter "for row in csvreader" line in the above code.

So I used the code below then the problem seemed to be solved

csvreader = csv.reader(codecs.open('1.csv', 'rU', 'utf-16'))
Run Code Online (Sandbox Code Playgroud)

Then I ran into NULL byte error. Then I can't …

python csv error-handling

5
推荐指数
2
解决办法
1万
查看次数

读取文本文件返回 UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in Python

即使我提到过,我也在使用 Python3 读取文本文件,encoding但它重新运行:

UnicodeDecodeError:'utf-8' 编解码器无法解码位置 96 中的字节 0x92:无效起始字节 [05/May/2018 03:35:45]“POST /app/HTTP/1.1”500 14383

它不是重复的,但它特定于byte 0x92.

这是我尝试过的:

txt = Path(text_path).read_text(encoding="utf-8")
Run Code Online (Sandbox Code Playgroud)

python character-encoding

0
推荐指数
1
解决办法
2162
查看次数