logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Encoding problem when apache started as services
Author
SorcererA



Joined: 21 Oct 2009
Posts: 1

PostPosted: Wed 21 Oct '09 8:41    Post subject: Encoding problem when apache started as services Reply with quote

Hello!

I have installed and used apache as usual at company like home.
However, I have encountered a werid problem at office computer.

Problem Descriptions:
I have created a function to read CSV file using fgetCSV() function (I have tried both fgetcsv() and splfileobj method, both produce same result)
(it is a news system, with date and news field)

If I run apache server with service installed
eg. http://localhost/test1.php, the first character of the line consists of unicode will become ?? character.

If I run apache server by manually starting the batch file.
It does not produce the problem.

This problem appear in my office computer which is clean installed not long ago.
System descriptions:
Windows XP SP3 English version

I have tried:
1. Test it at home. It does not produce the same result.
2. Put the scripts to the server, works too.
3. Reinstall the apache with different version including apache 2, 2.2.14 and PHP 5.2 and 5.3 separately.

I would like to know what is the difference between starting it from the batch file and starting automatically in services?
This may help in identifying the problem source.

I found this problem at first by using XAMPP, but I have tested to install the apache and php separately and can confirm that this is not the problem of XAMPP. Here are the screenshots. The result is same without XAMPP.


Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7355
Location: Germany, Next to Hamburg

PostPosted: Wed 21 Oct '09 11:45    Post subject: Reply with quote

I'm not realy sure what this error cause. But to prevent such things you can

a) send a UTF-8 header


Code:

header('Charset="utf-8"',true);


b) fix bad characters

for fixing bad UTF-8 charakters I posted on pastebin a script.
Back to top


Reply to topic   Topic: Encoding problem when apache started as services View previous topic :: View next topic
Post new topic   Forum Index -> Apache