replaceing strange characters -Ma¤rkisch-

Discussion in 'PHP' started by mahmood, Mar 1, 2006.

  1. #1
    I have an excel database and trying to read the content into mysql, as you probably know MS office does some funny things to non-english characters. for example instead of "Märkisch" it has "Ma¤rkisch".

    Now the problem is that I can not replace some of these characters such as "a¤" to their original form. I use str_replace but it doesnot recognise them.

    Any idea?
     
    mahmood, Mar 1, 2006 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    What if you use a unicode enabled font in Word? Then it should work I would think.
     
    digitalpoint, Mar 1, 2006 IP
  3. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Or you could save the excel file as a csv and open it in a text editor. Then run a macro in the text editor to search for each instance of the character and replace it with the correct one.
     
    mad4, Mar 2, 2006 IP
  4. mahmood

    mahmood Guest

    Messages:
    1,228
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I saved the file a CSV and opened it in notepad and characters were OK. So I change font arial to "Arial Unicode MS" which according to excel help should work fine with non-english characters but to no good.

    Any idea?
     
    mahmood, Mar 2, 2006 IP
  5. jordie

    jordie Peon

    Messages:
    7
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'm thinking its because they are double byte characters.... So in your case a¤ in MS word combine together to form ä.

    See if your PHP has mbstring functions: http://www.php.net/mbstring
     
    jordie, Mar 2, 2006 IP