How to save Excel file as csv with UTF-16 formatting

自作多情 提交于 2020-01-02 07:49:10

问题


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:


  1. In excel save file as CSV(Comma delimited)
  2. Open saved CSV file in notepad++
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!