php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25434 Include command with UTF-8 file returns undefined character
Submitted: 2003-09-08 09:05 UTC Modified: 2003-09-08 11:42 UTC
From: JanKarnik at atlas dot cz Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.3.3 OS: Win2K+iis
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: JanKarnik at atlas dot cz
New email:
PHP Version: OS:

 

 [2003-09-08 09:05 UTC] JanKarnik at atlas dot cz
Description:
------------
Include command with UTF-8 file returns undefined character.
Take a UTF-8 encoded php file with "include" or "require" command. Try include a UTF-8 encoded text.
On the begining of the above include you'll get returned an undefined character, shown in some browsers as a rectangle.
This character is used in windows to show that text has been UTF-8 encoded, but in all common editors (notepad...) is invisible.

Reproduce code:
---------------
bug.php:
<html><head><meta http-equiv="Content-Type" 
content="text/html; charset=UTF-8"></head>
<body>
<?php
<include"./text.txt">
?><body></html>


text.txt:
SOME UTF-8 ENCODED TEXT 
SOME UTF-8 ENCODED TEXT 
SOME UTF-8 ENCODED TEXT 

Expected result:
----------------
An unexpected chracters are returned 

Actual result:
--------------
?<html><head><meta http-equiv="Content-Type" 
content="text/html; charset=UTF-8"></head>
<body>
?SOME UTF-8 ENCODED TEXT 
SOME UTF-8 ENCODED TEXT 
SOME UTF-8 ENCODED TEXT <body></html>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-08 11:15 UTC] moriyoshi@php.net
Most likely the included file contains UTF-8 BOM marker at the beginning of it.

See also bug #22108.

Not a bug in PHP => bogus report.

 [2003-09-08 11:42 UTC] moriyoshi@php.net
> Hallo, 
> I'm sorry I didn not found the above bug allready repored.
> What do i need is a solution of my problem. 
> I need to use UTF-8, because I'm using several computes
> installed in 
> various languages and the UTF-8 is the only enconding used
> everywhere.
> What would you recomend me to do with the PHP scripts?
> 
> Thank you Jan Karnik.

Firstly, please DO NOT reply to the notification mail, always use this web interface.

Secondly, this is not a right forum for that kind of question. Instead, ask further question at the appropriate mailing list (php-i18n@list.php.net).

As for your question, just turn off the BOM feature of your editor.



 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Apr 20 01:01:28 2025 UTC