PHP: UTF8 CSV to UTF8 XML

Discussion in 'Web Design and Development' started by carlosbutler, May 5, 2011.

  1. carlosbutler macrumors 6502a

    carlosbutler

    Joined:
    Feb 24, 2008
    Location:
    London City
    #1
    I am trying to go through a CSV file and output that in to an XML structure. I have no problem at all with the CSV or the XML, just the data - specifically non ASCII characters.

    I keep getting the annoying question mark in a black diamond for latin characters such as é, ü etc

    I have tried setting a locale, but this does not appear to be working (I assume because I have not done it correctly)

    And help on getting that to work would be great
     
  2. Yvan256 macrumors 601

    Joined:
    Jul 5, 2004
    Location:
    Canada
    #2
    You need to make sure your files are actually saved in the correct format. In TextWrangler, you get a small menu at the bottom to help you set the text encoding (ISO Latin 1, UTF-8, etc) and the line-ending character type (Mac, Unix, Windows, etc).

    Make sure that all your files are in the correct type and if necessary check if the PHP functions that you are using are compatible with UTF-8 or whatever encoding format you are using.

    If you still can't find the problem, make sure that any code that you found on the Web weren't copy-pasted directly. Sometimes there's invisible illegal characters, I can't count the number of times I've fixed errors by simply re-typing the same code of the line that gave me the error.
     

Share This Page