Jump to content

Worked in Php4 now problems with Php5 (Leopard server)


Recommended Posts

Hi,

 

Fast background. We are a school board environment. We had a programmer build us a script that runs every night on a Apple 10.4 server (Php4) that interrogates our SQL server, takes info, format's it and then copies over to LDAP (OD). Since we are in Quebec, lots of entries have accents. The script was also used to strip the accents. We are now passing to Snow Leopard that runs Php5. I've got the scripts partially running but as soon as it meets an accent, it all stops and I get this error message:

 

iconv: (stdin):23:82: cannot convert

 

I look at at all scripts with textrangler and all are Unix and UTF-8. I wont post all the script but this first part doesnt pass:

 

StripAccents()

{

echo "$1" | tr "\351\311\350\310\352\312\353\313\356\316\357\317\364\324\366\326\371\331\373\333\374\334\340\300\342\302\344\304\347\307" "eEeEeEeEiIiIoOoOuUuUuUaAaAaAcC"

}

 

 

curl "http://myserver.ca:8080/imp_ldap/imp_ldap.php?Mode=ds_eleves&Annee=2009" > ImportEleves.txt

listToConvert=`cat ImportEleves.txt`

convertedList=`echo "$listToConvert" | iconv -f MAC -t Latin1`

StripAccents "$convertedList" > ImportEleves_fixed.txt

 

The ImportEleves.txt is complete then the ImportEleves_fixed.txt starts and stops at the first accent.

 

I'm realy lost in PHP.....need your help!

 

André

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.