473,394 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

php doesn't ignore the utf-8 BOM

"When a php file is saved in utf-8 format with the UTF-8 BOM as the first
three bytes of the file (EF BB BF), PHP doesn't ignore these bytes when
loading and compiling the file, but instead considers them output coming
prior to the <?php. This causes incorrect display of the page and
failure of any http header output."

I have this problem, I'm from croatia and I must use unicode (with php) but
php have this bug.
Is there a solution??
Jul 16 '05 #1
4 8864
In article <be**********@bagan.srce.hr>, ve*****@rijeka.riteh.hr says...

I have this problem, I'm from croatia and I must use unicode (with php) but
php have this bug.
Is there a solution??


I just made my website based on UTF-8 and XHTML. The only problem I ran
into was that PHP seems to dislike the firstline, the xml declaration:

<?xml version="1.0" encoding="utf-8"?>

The solution is to simply let php output the code:

<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"?".">"; ?>

But since you seem to have another problem it sounds to me like possibly
your webserver has some problems with the unicode. I am running apache.

Don't know I that helps you, but I had to mention.

jan
--
....and thanx for the fish!
Jul 16 '05 #2
> But since you seem to have another problem it sounds to me like possibly
your webserver has some problems with the unicode. I am running apache.


apache? me too
no, it's a universal problem with php <http://bugs.php.net/bug.php?id=22108>
huge bug if u ask me
Files in utf have 3 bytes in the beginning, before the first "<?php" and
there is a problem, php thinks that this is output to browser and cannot
send headers
Jul 16 '05 #3
In article <be**********@bagan.srce.hr>, ve*****@rijeka.riteh.hr says...
But since you seem to have another problem it sounds to me like possibly
your webserver has some problems with the unicode. I am running apache.


apache? me too
no, it's a universal problem with php <http://bugs.php.net/bug.php?id=22108>
huge bug if u ask me
Files in utf have 3 bytes in the beginning, before the first "<?php" and
there is a problem, php thinks that this is output to browser and cannot
send headers


Then it's most amusing that my UTF-8 Files do work as expected. They're
working locally and online (try them at http://www.pixelfaculty.de/)
with Opera, Netscape and Internet Explorer. Automatic Document Ecoding
Detection tells me it is UTF-8, I can open the files with UltraEdit to
check that they're UTF-8. And of course, all pages are using PHP. Even
if I don't manipulate the header data I just tried it, and it works as
expected.

Sometimes web development is more than funny :D

jan
--
....and thanx for the fish!
Jul 16 '05 #4
> Then it's most amusing that my UTF-8 Files do work as expected. They're
working locally and online (try them at http://www.pixelfaculty.de/)
with Opera, Netscape and Internet Explorer. Automatic Document Ecoding
Detection tells me it is UTF-8, I can open the files with UltraEdit to
check that they're UTF-8. And of course, all pages are using PHP. Even
if I don't manipulate the header data I just tried it, and it works as
expected.


maybe UltraEdit did not add this 3 bytes (BOM) in file, some editors
(dreamweaver) does add
Jul 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Thomas Müller | last post by:
Hello! Running my uploadscript on old server, php4.1.2 ignore aborted fileuploads. Now, the same script on new server doesn't ignore broken uploads. If anybody make a upload and abort this the...
2
by: Chris | last post by:
I am developing an web application which needs to support all kinds of languages, like english, european character set, and other asian character set. Therefore, UTF-8 can include all those...
27
by: EU citizen | last post by:
Do web pages have to be created in unicode in order to use UTF-8 encoding? If so, can anyone name a free application which I can use under Windows 98 to create web pages?
7
by: Philipp Lenssen | last post by:
How do I load and save a UTF-8 document in XML in ASP/VBS? Well, the loading* is not the problem actually -- the file is in UTF-8, and understood correctly -- but once saved, the UTF-8 is...
2
by: panda | last post by:
Dear ALL, How can I create an database of codepage UTF-16/UCS-2 in AIX DB2 V8? I tried to use "db2set db2codepage=1200" and "db2 terminate" but failed. I also tried to use "db2 create db abc...
4
by: A.M | last post by:
Hi, How can I set the option of RegularExpressionValidator to RegexOptions.IgnoreCase ? Thanks, Alan
11
by: Jean-François Michaud | last post by:
Hello all, I'm having a little problem, The UTF-8 parser we are using converts the newline entity ( ) within an attribute that we are using to paliate CSS limitations. After the parser has...
35
by: Bjoern Hoehrmann | last post by:
Hi, For a free software project, I had to write a routine that, given a Unicode scalar value U+0000 - U+10FFFF, returns an integer that holds the UTF-8 encoded form of it, for example, U+00F6...
1
by: =?Utf-8?B?VWp2YWwgU2hhaA==?= | last post by:
Hi, I am creating word document using UTF-7 in ASP.Net 2.0. so till the date, word document is opening perfactly in Word 2000 and word 2003. but in Word 2007, It show encoded text also like...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.