IT Log

Record various IT issues and difficulties.

How to convert the character encoding of a CSV file to UTF-8


To convert the character encoding of a CSV file to UTF-8, follow these steps:

  1. Identify the Current Encoding:
  2. Open the CSV file in an editor like Notepad++ or Excel.
  3. Check the encoding settings; Notepad++ can detect it under “Encoding.”

  4. Choose a Conversion Tool:

  5. Notepad++: Use the “Encoding” menu to convert directly.
  6. Excel: Open the CSV, save as UTF-8 under “File > Save As.”
  7. Command Line Tools: Use iconv or Python scripts for automated processes.

  8. Convert Encoding Using Notepad++:

  9. Open your file in Notepad++.
  10. Navigate to “Encoding” and select “Detect…” if unsure, then choose the detected encoding.
  11. Select “UTF-8” from the Encoding menu and save the file.

  12. Use Excel for Conversion:

  13. Open the CSV file in Excel.
  14. Go to “File > Save As,” choose “CSV UTF-8 (*.csv)” as the format.
  15. Save your changes.

  16. Command Line with iconv:

  17. Open a terminal and run:
    iconv f original_encoding t utf8 file.csv > new_file.csv
    Replace original_encoding with the current encoding (e.g., ISO-8859-1).

  18. Verify the Conversion:

  19. Ensure no data loss or corruption by opening the converted file in a text editor or application.

By following these steps, you can reliably convert your CSV file to UTF-8 encoding.


, , , ,