microsoft excel 2010 - How to convert UTF-8 to SHIFT-JIS using vba

07
2014-07
  • user275763

    I am developing an application that reads from a text file and writes to a CSV file.
    Since characters in the text file are UTF-8, the CSV file also contain the same characters.
    Because of UTF-8, Double Byte(Japanese Character) cannot be written correctly in a CSV file.
    Please explain the best way to write correct data.

  • Answers
  • Dave Rook

    Most answers I've seen are work arounds, doing it manually in Google Docs or NotePad ++ or similar. The link I give offers many suggestions which may or may not suffice. The one answer by Eric may be the most useful:

    ... I tried saving the xlsx file to xls first, then to csv. It actually worked.

    Sadly, one of the answers there simply writes

    I was not able to find a VBA solution for this problem on Mac Excel. There simply seemed to be no way to output UTF-8 text.

    Source and more options

    You may be able to do this in CSV, then write a script to convert it in NotePad++ but it looks like there may have to be some manual work.


  • Related Question

    encoding - Utility for converting Shift-JIS encoded files to UTF-8 encoded files
  • frankadelic

    My client has a ton of Japanese text files which are encoded in Shift-JIS.

    They need a utility which can convert these files to UTF-8.

    Ideally, the tool would offer both command-line and interactive options.

    Any suggestions?

    (PS - could someone with rep add the "shift-jis" tag?)


  • Related Answers
  • Ignacio Vazquez-Abrams

    iconv (or iconv, as the case may be).

  • Lưu Vĩnh Phúc

    ConvertZ is also a good free alternative