问题
I am having an issue with Excel not saving my files properly. I have a list of data which is organized into three columns: String String INt.
I want to read this file into a Java program to perform some calculations. Excel exporting as a .csv file causes me to lose significant data as a result of the native UTF-8 encoding. I can save it as a UTF-16 .txt file however, I get another annoying result. If i insert columns of commas between each field field it saves the commas with quotes around it! I have seen some solutions to this problem but they do not preserve the UTF-16 encoding.
Any help would be greatly appreciated.
回答1:
- In excel save file as CSV(Comma delimited)
- Open saved CSV file in notepad++
- Encoding -> Convert tO UCS-2 Big Endian
Done.
回答2:
Is this a one time thing or are you doing it as part of a larger program? If it's a one time thing you can just do a find and replace on the "," in any text editor.
来源:https://stackoverflow.com/questions/13019620/how-to-save-excel-file-as-csv-with-utf-16-formatting