PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.smarty.general > can't identify/eliminate source of "odd characters" in template-generatedpage source
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
can't identify/eliminate source of "odd characters" in template-generatedpage source

Réponse
 
LinkBack Outils de la discussion
Vieux 03/01/2006, 04h08   #1 (permalink)
OpenMacNews
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut can't identify/eliminate source of "odd characters" in template-generatedpage source

-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

hi all,

i've Smarty-2.6.11 + PHP 5.1.1 + Apache 2.3.0-dev installed on OSX 10.4.3.

getting my site up just fine, to date.

one annoyance is driving me nuts though ... i've got some "errant" characters showing up in my
browser-display ... and in my generated page source.

e.g., in one case, my page-top template, ("doctype_header.tpl") is, simply:

========================
<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=macintosh" />
========================


but, after generation, i'm seeing the following characters DISPLAYED at the top of my browser
page display:

 

and the generated source is:


========================
Ôªø
Ôªø
<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=macintosh" />
========================

NOTE, those first two lines of #^%$ ...

this smells line an encoding issue, but for the lif o' me, i can't figure out where to look for
/ fix this.

suggestions?

thanks!

richard

- --

/"\
\ / ASCII Ribbon Campaign
X against HTML email, vCards
/ \ & micro$oft attachments

[GPG] OpenMacNews at gmail dot com
fingerprint: 50C9 1C46 2F8F DE42 2EDB D460 95F7 DDBD 3671 08C6
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iEYEAREDAAYFAkO5+LcACgkQlffdvTZxCMYbGACfX8cRDxrcJi mv7aZbqQOoJhcc
Yn0An27laHSpiUy48dg0dmUgMXTaqCAd
=w381
-----END PGP SIGNATURE-----
  Réponse avec citation
Vieux 03/01/2006, 05h16   #2 (permalink)
Mark Wright
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] can't identify/eliminate source of "odd characters" in template-generated page source

Try this:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

Make sure you are using a plain text editor, not textedit.


Mark

On 1/2/06, OpenMacNews <openmacnews@gmail.com> wrote:
> ========================
> <!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html lang="en">
> <head>
> <meta http-equiv="content-type" content="text/html; charset=macintosh" />
> ========================



--
Have fun or die trying - but try not to actually die.
http://www.AboveCalifornia.com
Got Mac OS X? Get the AboveCalifornia Sherlock Channel:
sherlock://www.AboveCalifornia.com/sherlock/SherlockChannel.xml?action=add
  Réponse avec citation
Vieux 03/01/2006, 05h38   #3 (permalink)
OpenMacNews
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] can't identify/eliminate source of "odd characters"in template-generated page source

-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

hi mark,

thanks 4 the reply!

Mark Wright wrote:
> Try this:
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
>
> Make sure you are using a plain text editor, not textedit.


using that encoding CHANGES the characters, but does not eliminate them ... which makes me
fairly _certain_ it's the encoding of some silly &^*&! file in my mess.

i think a bulk line-ending/encoding housecleaning of all my text file is in order ... now if i
can just remember how to set them in shell!

cheers,

richard

- --

/"\
\ / ASCII Ribbon Campaign
X against HTML email, vCards
/ \ & micro$oft attachments

[GPG] OpenMacNews at gmail dot com
fingerprint: 50C9 1C46 2F8F DE42 2EDB D460 95F7 DDBD 3671 08C6
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iEYEAREDAAYFAkO6DewACgkQlffdvTZxCMbeRACdFxsJ47bKl5 CWtEr+sGSpRyLQ
2JgAn11ffSkI7k11Qtxo11OyWhl4UnmS
=J7Ki
-----END PGP SIGNATURE-----
  Réponse avec citation
Vieux 03/01/2006, 08h26   #4 (permalink)
Patrick Ben Koetter
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] can't identify/eliminate source of "odd characters" in template-generated page source

* OpenMacNews <openmacnews@gmail.com>:
> hi mark,
>
> thanks 4 the reply!
>
> Mark Wright wrote:
> > Try this:
> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> >
> > Make sure you are using a plain text editor, not textedit.

>
> using that encoding CHANGES the characters, but does not eliminate them ... which makes me
> fairly _certain_ it's the encoding of some silly &^*&! file in my mess.
>
> i think a bulk line-ending/encoding housecleaning of all my text file is in order ... now if i
> can just remember how to set them in shell!


My last lesson had been: No whitespace before or after <?php ?>.

p@rick

--
state of mind
Agentur für Kommunikation und Design

Patrick Koetter Tel: 089 45227227
Echinger Strasse 3 Fax: 089 45227226
85386 Eching Web: http://www.state-of-mind.de
  Réponse avec citation
Vieux 03/01/2006, 09h54   #5 (permalink)
messju mohr
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] can't identify/eliminate source of "odd characters" in template-generated page source

On Mon, Jan 02, 2006 at 08:08:24PM -0800, OpenMacNews wrote:
[...]
> but, after generation, i'm seeing the following characters DISPLAYED at the top of my browser
> page display:
>
>  
>

[...]

what you see is a BOM (Byte Order Mark). see
http://www.unicode.org/faq/utf_bom.html and configure your text editor
to not write the BOM in front of any text file. neither php nor smarty
like it.

HTH
messju
  Réponse avec citation
Vieux 03/01/2006, 10h53   #6 (permalink)
Jochem Maas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] can't identify/eliminate source of "odd characters"in template-generated page source

Patrick Ben Koetter wrote:
> * OpenMacNews <openmacnews@gmail.com>:
>
>>hi mark,
>>
>>thanks 4 the reply!
>>
>>Mark Wright wrote:
>>
>>>Try this:
>>><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
>>>
>>>Make sure you are using a plain text editor, not textedit.

>>
>>using that encoding CHANGES the characters, but does not eliminate them ... which makes me
>>fairly _certain_ it's the encoding of some silly &^*&! file in my mess.
>>
>>i think a bulk line-ending/encoding housecleaning of all my text file is in order ... now if i
>>can just remember how to set them in shell!

>
>
> My last lesson had been: No whitespace before or after <?php ?>.


better yet just drop the last ?> if there is no static text to output in the rest of
the file... e.g.

---------------------------------------------------
<?php

phpinfo();
include "my_special_info.php"

?>

---------------------------------------------------

becomes:

---------------------------------------------------
<?php

phpinfo();
include "my_special_info.php"


---------------------------------------------------

no more trailing spaces issues at any rate :-)

>
> p@rick
>

  Réponse avec citation
Vieux 03/01/2006, 17h10   #7 (permalink)
OpenMacNews
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] can't identify/eliminate source of "odd characters"in template-generated page source

-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

hi messju,

messju mohr wrote:
> On Mon, Jan 02, 2006 at 08:08:24PM -0800, OpenMacNews wrote:
> [...]
>> but, after generation, i'm seeing the following characters DISPLAYED at the top of my browser
>> page display:
>>
>>  
>>

> [...]
>
> what you see is a BOM (Byte Order Mark). see
> http://www.unicode.org/faq/utf_bom.html and configure your text editor
> to not write the BOM in front of any text file. neither php nor smarty
> like it.


bingo. _one_ of my templates was typed as "UTF-8 with BOM" (i have *no* idea why/how!?).
changing its type to be Western/Latin1 fixed the problem ... weird characters gone!

thx! it would've been a *while* b4 i found that :-)

cheers,

richard


- --

/"\
\ / ASCII Ribbon Campaign
X against HTML email, vCards
/ \ & micro$oft attachments

[GPG] OpenMacNews at gmail dot com
fingerprint: 50C9 1C46 2F8F DE42 2EDB D460 95F7 DDBD 3671 08C6
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iEYEAREDAAYFAkO6sA0ACgkQlffdvTZxCMYIxwCeOz5JljSGxv 6CDbE2egAdtgD6
jUgAnAxgN+pII9BuFUX/xFaGtGTtXPkF
=Ib47
-----END PGP SIGNATURE-----
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 11h02.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15091 seconds with 15 queries