0

I am trying to save a table from excel to a CSV file. This file will be used to import data in a database. My characters are hungarian(Working: öüópúéá - Showing question marks: őű) and romanian (Showing question marks instead of all: ăîâțș)

I tried the following:

  • saving it then opening it with notepad then changing the encoding from ANSI to UTF-8 (did the same using Notepad++)
  • changing the options in the save as form (Save as > Tools > Web Options > Encoding > Save this document as). I tried Unicode(UTF-8) and Central European(ISO)
  • I heard of the trick when you can open it with Google Spreadsheet then download it as CSV and it resolves the problem (didnt try). Cant use this because the data from the tables are extreemly confidential

I would like to get a different solution if possible. It would be nice to hear that i missed something at the export setting.

If no other idea I will try to write a PHP import code that will be able to process the XLS file, but I don`t know how the XLS file is structured.

tshepang
  • 11,360
  • 21
  • 88
  • 132
Czoka
  • 118
  • 3
  • 12
  • It's hard to believe you're failing to save the file as UTF-8. Have you considered that perhaps you are not importing it correctly? – Álvaro González Aug 11 '14 at 11:22
  • 1
    Why not read it as an Excel file rather than as a CSV for your import? In addition to my own PHPExcel library, there are dozens of other Excel Reader libraries for PHP, so no need to write your own – Mark Baker Aug 11 '14 at 11:25
  • The problem is with the saving, because when I open the CSV file with Notepad it shows question marks instead of the special characters, same if I reopen the file with Excel – Czoka Aug 11 '14 at 11:28
  • @MarkBaker going to try it. I will use the PHP Excel Reader from [code.google.com](https://code.google.com/p/php-excel-reader/) version 2.21 : 2009-04-14. Have you heard of it, is it good for the job? – Czoka Aug 11 '14 at 11:47
  • 1
    I'm familiar with most of the libraries capable of working with spreadsheet format documents in PHP; but as the developer of PHPExcel I prefer not to make recommendations on the grounds that it's a loaded question; though I do maintain [this list](http://stackoverflow.com/questions/3930975/alternative-for-php-excel) with some information about the various options – Mark Baker Aug 11 '14 at 11:52
  • @MarkBaker could you show me the way I can read data from a field and write data to a field using PHP and xls, the simplest example because I will not write formulas or text formating or anything like that. (Or a link to a step-by-step tutorial) – Czoka Aug 11 '14 at 12:11

0 Answers0