Strange characters appearing from includes
Strange characters appearing from includes
am 26.06.2007 15:06:00 von dorayme
I have been getting some strange characters appear from my local
server when some markup is delivered via a php include. Even when
I select all in the include file and delete and save, I get,
naturally enough none of the usual text icorporated. Yet these
characters appear at the top of the include in all browsers.
Sorry, I have not identified exactly the factors causing this
yet. The characters concerned are:

Anyone recognise these and so give me any sort of clue that could
be helpful in tracking the source of the problem please? (Hard to
know if these will appear correctly when I post this. Might have
to screen shot them...)
--
dorayme
Re: Strange characters appearing from includes
am 26.06.2007 15:17:04 von Benjamin Niemann
Hello,
dorayme wrote:
> I have been getting some strange characters appear from my local
> server when some markup is delivered via a php include. Even when
> I select all in the include file and delete and save, I get,
> naturally enough none of the usual text icorporated. Yet these
> characters appear at the top of the include in all browsers.
> Sorry, I have not identified exactly the factors causing this
> yet. The characters concerned are:
>
> 
>
> Anyone recognise these and so give me any sort of clue that could
> be helpful in tracking the source of the problem please? (Hard to
> know if these will appear correctly when I post this. Might have
> to screen shot them...)
Look like a BOM. Configure your editor not to write a BOM at the start of
the file.
HTH
--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/
Re: Strange characters appearing from includes
am 26.06.2007 15:24:50 von a.nony.mous
dorayme wrote:
> I have been getting some strange characters appear from my local
> server when some markup is delivered via a php include. ...
It may help if you posted a link to the script - make a copy and name it
include.phps - and to the page showing the result.
Make a test case if there is anything proprietary.
--
-bts
-Motorcycles defy gravity; cars just suck
Re: Strange characters appearing from includes
am 26.06.2007 16:03:44 von dorayme
In article ,
Benjamin Niemann wrote:
> Hello,
>
> dorayme wrote:
>
> > I have been getting some strange characters appear from my local
> > server when some markup is delivered via a php include. Even when
> > I select all in the include file and delete and save, I get,
> > naturally enough none of the usual text icorporated. Yet these
> > characters appear at the top of the include in all browsers.
> > Sorry, I have not identified exactly the factors causing this
> > yet. The characters concerned are:
> >
> > 
> >
> > Anyone recognise these and so give me any sort of clue that could
> > be helpful in tracking the source of the problem please? (Hard to
> > know if these will appear correctly when I post this. Might have
> > to screen shot them...)
>
> Look like a BOM. Configure your editor not to write a BOM at the start of
> the file.
>
Will have to figure out what preferences to change in my BBEdit
to achieve this. In the morning! I just fiddled about with prefs
and got some very interesting further trouble. So I think this is
on the right track. I have had some trouble understanding what
the best policy is for web development in regard to settings
generally, there being so much choice. More later, thanks.
--
dorayme
Re: Strange characters appearing from includes
am 26.06.2007 16:08:13 von dorayme
In article
,
"Beauregard T. Shagnasty" wrote:
> dorayme wrote:
>
> > I have been getting some strange characters appear from my local
> > server when some markup is delivered via a php include. ...
>
> It may help if you posted a link to the script - make a copy and name it
> include.phps - and to the page showing the result.
>
> Make a test case if there is anything proprietary.
Yes, if BN's clue does not lead me to solution, this is what I
will do. (It is on my local server on my Mac. I have not worked
out how to let the world see my local server yet. But it will
probably duplicate on an external one that you can see too).
--
dorayme
Re: Strange characters appearing from includes
am 26.06.2007 16:38:32 von BootNic
> dorayme wrote:
> news: doraymeRidThis-28E087.23060026062007@news-vip.optusnet.com.a u
> I have been getting some strange characters appear from my local
> server when some markup is delivered via a php include. Even when
> I select all in the include file and delete and save, I get,
> naturally enough none of the usual text icorporated. Yet these
> characters appear at the top of the include in all browsers.
> Sorry, I have not identified exactly the factors causing this
> yet. The characters concerned are:
>
> 
>
> Anyone recognise these and so give me any sort of clue that could
> be helpful in tracking the source of the problem please? (Hard to
> know if these will appear correctly when I post this. Might have
> to screen shot them...)
If a include file is saved in UTF-8 with BOM and included in a file
served as iso-8859-1, one could expect to see the same result.
As Benjamin Niemann suggest, save utf-8 without BOM, as well as the
document its going to be included in.
Serve your document as utf-8
header("Content-Type:text/html; charset=utf-8");
?>
or you could change your php default charset
default_mimetype = "text/html"
default_charset = "utf-8"
--
BootNic Tuesday, June 26, 2007 10:37 AM
Genius is eternal patience.
*Michelangelo*
Re: Strange characters appearing from includes
am 26.06.2007 17:33:05 von Chaddy2222
On Jun 26, 11:06Â pm, dorayme wrote:
> I have been getting some strange characters appear from my local
> server when some markup is delivered via a php include. Even when
> I select all in the include file and delete and save, I get,
> naturally enough none of the usual text icorporated. Yet these
> characters appear at the top of the include in all browsers.
> Sorry, I have not identified exactly the factors causing this
> yet. The characters concerned are:
>
> ï»=BF
>
> Anyone recognise these and so give me any sort of clue that could
> be helpful in tracking the source of the problem please? (Hard to
> know if these will appear correctly when I post this. Might have
> to screen shot them...)
>
I had a similar issue to what you discribe the other day, but it was
from useing an incorrect characer encodeing, UTF-8 instead of my
useual endodeing. If you think it's a PHP thing though, check your
error logs.
--
Regards Chad. http://freewebdesign.awardspace.biz
Re: Strange characters appearing from includes
am 26.06.2007 17:39:15 von Chaddy2222
On Jun 27, 12:38Â am, "BootNic" wrote:
> > dorayme wrote:
> >news: doraymeRidThis-28E087.23060026062__BEGIN_MASK_n#9g02mG7!__.. .__END=
_MASK_i?a63jfAD$z__@news-vip.optusnet.com.au
> > I have been getting some strange characters appear from my local
> > server when some markup is delivered via a php include. Even when
> > I select all in the include file and delete and save, I get,
> > naturally enough none of the usual text icorporated. Yet these
> > characters appear at the top of the include in all browsers.
> > Sorry, I have not identified exactly the factors causing this
> > yet. The characters concerned are:
>
> > ï»=BF
>
> > Anyone recognise these and so give me any sort of clue that could
> > be helpful in tracking the source of the problem please? (Hard to
> > know if these will appear correctly when I post this. Might have
> > to screen shot them...)
>
> If a include file is saved in UTF-8 with BOM and included in a file
> served as iso-8859-1, one could expect to see the same result.
>
> As Benjamin Niemann suggest, save utf-8 without BOM, as well as the
> document its going to be included in.
>
> Serve your document as utf-8
>
> Â Â header("Content-Type:text/html; charset=3Dutf-8");
> ?>
> or you could change your php default charset
>
> default_mimetype =3D "text/html"
> default_charset =3D "utf-8"
>
Yes, this sounds like what I was trying to get at. I am half a sleep
though so kind of worded it badly.
But I know what I ment.
--
Regards Chad. http://freewebdesign.awardspace.biz
Re: Strange characters appearing from includes
am 26.06.2007 17:51:50 von Toby A Inkster
dorayme wrote:
> I have been getting some strange characters appear from my local
> server when some markup is delivered via a php include.
This probably isn't your problem, but I thought I'd like to mention
it anyway, just in case.
Mac OS X likes to create a hidden file in each directory called
".DS_Store". If you use any PHP code that loops through an entire
directory and includes each file found there (which is what I do
to load plugins for my CMS) then this will cause the binary
".DS_Store" file to be included, adding about a kilobyte or so of
random crap to your output. This happens if you're using Mac OS X
as your server OS (as I was), or have uploaded an entire directory
from a Mac OS X development machine onto your server.
I solved this by telling my plugin loading mechanism to ignore all
files with names that start with a dot.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 5 days, 19:24.]
A New Look for TobyInkster.co.uk
http://tobyinkster.co.uk/blog/2007/06/22/new-look/
Re: Strange characters appearing from includes
am 26.06.2007 21:53:11 von Andy Dingley
On Tue, 26 Jun 2007 23:06:00 +1000, dorayme
wrote:
>
That's a BOM. Your server (and probably the main page) are expecting
UTF-8, your include file has got itself into UTF-8Y / UTF-8_with_a_BOM
instead.
jEdit is one of the best editors around for sorting out this sort of
problem.
Re: Strange characters appearing from includes
am 27.06.2007 00:23:36 von dorayme
In article <4ir283hccrpkkjfvabvc75r353t0hmioct@4ax.com>,
Andy Dingley wrote:
> On Tue, 26 Jun 2007 23:06:00 +1000, dorayme
> wrote:
>
> >
>
> That's a BOM. Your server (and probably the main page) are expecting
> UTF-8, your include file has got itself into UTF-8Y / UTF-8_with_a_BOM
> instead.
>
> jEdit is one of the best editors around for sorting out this sort of
> problem.
Thanks everyone, yes I changed my settings in preferences in my
editor. And the problem I was seeing has gone away. I have chosen
"UTF-8 no BOM" for file save. This is giving me no trouble that I
can see.
Frankly, I would like to see what a competent Mac web developer
with BBEdit or TextWrangler is using for all the important
settings. I have the "Default Line Breaks" as Unix, (rather than
Mac or DOS/Windows) and I tick the box underneath "Use Unicode
Line Breaks".
Perhaps I should mount a loudspeaker on my car and go up and down
Sydney Streets begging to be let in to spy on such a Mac users
preferences. And just simply copy them.
--
dorayme
Re: Strange characters appearing from includes
am 27.06.2007 00:36:22 von dorayme
In article ,
Toby A Inkster wrote:
> dorayme wrote:
>
> > I have been getting some strange characters appear from my local
> > server when some markup is delivered via a php include.
>
> This probably isn't your problem, but I thought I'd like to mention
> it anyway, just in case.
>
> Mac OS X likes to create a hidden file in each directory called
> ".DS_Store". If you use any PHP code that loops through an entire
> directory and includes each file found there (which is what I do
> to load plugins for my CMS) then this will cause the binary
> ".DS_Store" file to be included, adding about a kilobyte or so of
> random crap to your output. This happens if you're using Mac OS X
> as your server OS (as I was), or have uploaded an entire directory
> from a Mac OS X development machine onto your server.
>
> I solved this by telling my plugin loading mechanism to ignore all
> files with names that start with a dot.
If I ever supect trouble on this score, I might have to ask you
how you tell a "plugin loading mechanism" or any other relevant
mechanism such a thing. I am not aware of any such files on
external servers - the only ones that really matter to me. (I
have had some close oddities on occasions, Mac keep resource
forks and it is a bit of a nuisance when communicating with non
Mac file systems sometimes.)
--
dorayme
Re: Strange characters appearing from includes
am 27.06.2007 02:34:53 von Hans-Peter Diettrich
BootNic wrote:
> If a include file is saved in UTF-8 with BOM and included in a file
> served as iso-8859-1, one could expect to see the same result.
>
> As Benjamin Niemann suggest, save utf-8 without BOM, as well as the
> document its going to be included in.
As long as a BOM is recognized only at the very begin of an file, it
should be removed while reading *any* file. If required, a new BOM can
be emitted when saving or transmitting the new document.
DoDi
Re: Strange characters appearing from includes
am 27.06.2007 08:30:09 von Toby A Inkster
dorayme wrote:
> Frankly, I would like to see what a competent Mac web developer
> with BBEdit or TextWrangler is using for all the important
> settings. I have the "Default Line Breaks" as Unix, (rather than
> Mac or DOS/Windows) and I tick the box underneath "Use Unicode
> Line Breaks".
http://examples.tobyinkster.co.uk/TextWranglerPrefs
Would you like to see any of the other pages?
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 6 days, 10:09.]
The End of an Era
http://tobyinkster.co.uk/blog/2007/06/26/end-of-an-era/
Re: Strange characters appearing from includes
am 27.06.2007 09:28:07 von dorayme
In article ,
Toby A Inkster wrote:
> dorayme wrote:
>
> > Frankly, I would like to see what a competent Mac web developer
> > with BBEdit or TextWrangler is using for all the important
> > settings. I have the "Default Line Breaks" as Unix, (rather than
> > Mac or DOS/Windows) and I tick the box underneath "Use Unicode
> > Line Breaks".
>
> http://examples.tobyinkster.co.uk/TextWranglerPrefs
>
> Would you like to see any of the other pages?
Thanks so much for this Toby. Yes, it is really great to see this
to remove some uncertainties in my mind. After the general advice
in the thread, I had your settings except for "Force New Line at
End" (this sounds like a little something cosmetic to give a bit
of grace at the end). I have ticked it now.
On Text Encodings I have mostly had "Enable All" and so all
ticked. But in my fiddlings recently, changed it to BBEdit
Defaults. I mention this because this one could be tricky for you
to screen shot*! I notice all the unicode entries on this panel
are feint but ticked? Yes please, I would be keen to know what
arrangement you have found best on this panel.
And, if you can be bothered, Text Files: Opening too please.
So, just these two more please.
-------------
* BBedit, TextWrangler panel windows have traditionally not been
resizable. It is particularly irksome in the S&R window (which I
use extensively).
--
dorayme
Re: Strange characters appearing from includes
am 27.06.2007 12:59:14 von Toby A Inkster
dorayme wrote:
> On Text Encodings I have mostly had "Enable All" and so all
> ticked. But in my fiddlings recently, changed it to BBEdit
> Defaults. I mention this because this one could be tricky for you
> to screen shot*! I notice all the unicode entries on this panel
> are feint but ticked? Yes please, I would be keen to know what
> arrangement you have found best on this panel.
I just have the defaults. As I rarely edit non-English files, I've never
felt the need to add in any other encodings.
> And, if you can be bothered, Text Files: Opening too please.
http://examples.tobyinkster.co.uk/TextWranglerPrefs2
The "if file's encoding can't be guessed" setting may well be different
for you. If you open files that are likely to have been edited in another
Mac editor, then I'd probably recommend "Western (Mac OS Roman)" or if
Windows, "Western (Windows Latin 1)". I mostly open files that I've been
editing in Nedit on my Linux box, so ISO encoding works best for me.
The "Honor Saved State" settings are a matter of personal taste.
The reason for enforcing a new line character at the end of each file is
to play nice with command line tools like "cat". Also, "gcc" balks at
files that don't end with a new line character, not that I do an awful lot
of C programming.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 6 days, 14:25.]
The End of an Era
http://tobyinkster.co.uk/blog/2007/06/26/end-of-an-era/
Re: Strange characters appearing from includes
am 28.06.2007 00:46:14 von dorayme
In article <2hs9l4-9se.ln1@ophelia.g5n.co.uk>,
Toby A Inkster wrote:
> dorayme wrote:
>
> > On Text Encodings I have mostly had "Enable All" and so all
> > ticked. But in my fiddlings recently, changed it to BBEdit
> > Defaults.
>
> I just have the defaults.
> > And, if you can be bothered, Text Files: Opening too please.
>
> http://examples.tobyinkster.co.uk/TextWranglerPrefs2
>
Your picture is so accurate that it took me hours to work out why
I could not change the settings on it. Seriously, thanks for
this. The only thing I had different was honour Font Settings.
>
> The reason for enforcing a new line character at the end of each file is
> to play nice with command line tools like "cat". Also, "gcc" balks at
> files that don't end with a new line character
Ah, so that is the reason.
--
dorayme