For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > July 2004 > Re: [SMARTY] Smarty and UTF8 encoded files









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [SMARTY] Smarty and UTF8 encoded files
Boots

2004-07-24, 8:59 pm

--- nemanja@chorlya.com wrote:
> Hi all,
>
> I have a strange problem with smarty and UTF8 encoded files on
> Win2000
> maschine.
> I've searched archives and posted to smarty forum on phpinsider.com
> but no
> one replyed yet :(
>
> Here's the problem:
> my template is in UTF8 encoded file and when smarty compiles it, it
> adds
> some characters(see below) on the begining of first line and that is
> breaking my design.
> I'm runing PHP 4.3.0 and Smarty 2.6.3.
>
> Is Smarty even suposed to work with UTF8 files, and is there a
> solution to
> this problem?
> If I convert the file to any one-byte encoding then it works OK, but
> that's not the solution really ;)
> Thanks
>
> first 16 bytes of my template file:
> FF FE 3C 00 21 00 44 00 4F 00 43 00 54 00 59 00 ; ÿþ<.!.D.O.C.T.Y.
>
> same line in compiled template file:
> FF FE FF FE 3C 00 21 00 44 00 4F 00 43 00 54 00 ; ÿþÿþ<.!.D.O.C.T.
>
> first 16 bytes of what browser recives:
> FF FE 09 00 FF FE 3C 00 21 00 44 00 4F 00 43 00 ; ÿþ..ÿþ<.!.D.O.C.


I've seen that happen with certain editors that want to add the
encoding type bytes to the beggining of files (those first two bytes,
FF FE). They don't play nice and they aren't strictly needed; try
setting your editor not to write them and remove them from existing
files.

xo boots
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com