简体   繁体   English

java.nio.charset.IllegalCharsetNameException:Windows-1252 / WinLatin 1

[英]java.nio.charset.IllegalCharsetNameException: Windows-1252/WinLatin 1

When i parsed my CSV file this error is generated.My CSV file has the font type of Windows-1252/WinLatin 1. So i set the this as character set at the time of parsing. 当我解析我的CSV文件时,会生成此错误。我的CSV文件的字体类型为Windows-1252 / WinLatin 1.所以我在解析时将其设置为字符集。 How can i solve this problem. 我怎么解决这个问题。 My code is : 我的代码是:

reader = new CSVReader(new InputStreamReader(new FileInputStream(
                    new File(directory)),
                    Charset.forName("Windows-1252/WinLatin 1")), Configuration.CSV_SEPERATOR);

You should use Charset.forName("windows-1252") or Charset.forName("Cp1252") , to avoid IllegalCharsetNameException. 您应该使用Charset.forName("windows-1252")Charset.forName("Cp1252")来避免IllegalCharsetNameException。 (As McDowell said above.) (正如麦克道尔上面所说的那样。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM