gpt4 book ai didi

java - Windows 上的 Excel 中无法正确显示西类牙语特殊字符适用于 Linux

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:20:06 24 4
gpt4 key购买 nike

我的 oracle 数据库中有西类牙文数据 (charectorset AL32UTF8)。我正在从数据库读取数据并写入 csv 文件,然后从 csv 再次读取数据并进行一些操作。但在 csv 文件中它显示垃圾值。

我在 linux 上做了同样的事情,它工作正常。

public class T {

CSVWriter out = null;

private void write(String[] values) throws IOException {
out.writeNext(values);
}

public static void main(String[] args) throws IOException {

File f = new File("s.csv");

FileOutputStream os = new FileOutputStream(f, false);

CSVWriter out = new CSVWriter(
new BufferedWriter(
new OutputStreamWriter(
os, "UTF-8")));
}
}

最佳答案

打开CSV文件时你必须告诉Excel使用正确的编码

见下文:

Is it possible to force Excel recognize UTF-8 CSV files automatically?

关于java - Windows 上的 Excel 中无法正确显示西类牙语特殊字符适用于 Linux,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44497504/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com