File Conversion In PHP?

Discussion in 'PHP' started by Quozt, Jun 12, 2007.

  1. #1
    I'm working with CSV files in php and we have a system that outputs them, i've been working for the last hour on how to get php to read them without inserting funny characters into the code and the problem was the file encoding, if I open the files in notepad and save it with a UTF-8 encoding, the files open perfectly, is it possible to convert the files with php rather than open 100+ files a month in notepad and save with a different encoding.

    Ta Very Much!

    Dom
     
    Quozt, Jun 12, 2007 IP
  2. norfstar

    norfstar Peon

    Messages:
    1,154
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If the files are in ISO-8859-1, just running utf8_encode() on them should do the trick.
     
    norfstar, Jun 12, 2007 IP
  3. Quozt

    Quozt Peon

    Messages:
    216
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    AFAIK the utf8_encode only works with xml files doesn't it?

    Firefox says the file is encoded with UTF-16LE
     
    Quozt, Jun 12, 2007 IP
  4. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #4
    Its non sepcific, however it won't work for you.

    you'll be better of using mb_convert_encoding()
     
    krakjoe, Jun 12, 2007 IP