Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty and UTF8 encoded files

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
chorlya
Smarty n00b


Joined: 23 Jul 2004
Posts: 1

PostPosted: Fri Jul 23, 2004 5:29 pm    Post subject: Smarty and UTF8 encoded files Reply with quote

Hi all,

I have a strange problem with smarty and UTF8 encoded files on Win2000 maschine. I'm runing PHP 4.3.0 and Smarty 2.6.3.
Here's the problem:
my template is in UTF8 encoded file and when smarty parses it, it adds some characters(see below) on the begining of first line and that is breaking my design. Is Smarty even suposed to work with UTF8 files? And is there a solution to this problem?
If I convert the file to ascii then it works OK, but that's not it really Wink
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.
Back to top
View user's profile Send private message
nguyenvinhquang
Smarty n00b


Joined: 25 Oct 2004
Posts: 1

PostPosted: Mon Oct 25, 2004 11:03 am    Post subject: Reply with quote

I'v got the same problem Sad. I'm a Vietnamese and my web pages must be saved in UTF-8 format. Anybody tell me how to solve this problem! Thanks!
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Mon Oct 25, 2004 11:23 am    Post subject: Reply with quote

you have to remove the BOM (Byte Order Mark, the 0xfffe) from the beginning of all files.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Janis
Smarty Rookie


Joined: 11 Jan 2007
Posts: 10

PostPosted: Thu Jul 05, 2007 7:42 pm    Post subject: Reply with quote

Anybody who had this problem succeeded in solving them?

I have exactly the same problem! (I really didn't thought there would be topic about this or if there were - I wouldn't be able to find it. Very Happy)

And I checked all the templates that are being used, and none of them have anything odd at the front. Not now anyway. I checked it with several editors to be sure of it, including Linux vim editor which clearly showed two FEFF characters in front of the resulting web page source.

Where else could this extra character/s?
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Jul 06, 2007 6:26 am    Post subject: Reply with quote

Look harder and make sure you tell your editor to save files without the BOM. Based on the first post, I think Messju is 100% right (as usual!).

Best of luck.
Back to top
View user's profile Send private message
Janis
Smarty Rookie


Joined: 11 Jan 2007
Posts: 10

PostPosted: Sun Jul 08, 2007 7:41 pm    Post subject: Reply with quote

OK, I found a BOM in some language file in the other script I used (which used Smarty). That's one BOM less. Very Happy

I cannot find the other one but I probably won't look more as only two BOMs result in an extra space in IE6, one apparently doesn't matter.

Thanks!
Back to top
View user's profile Send private message
Numinvest
Smarty n00b


Joined: 03 Feb 2010
Posts: 1

PostPosted: Thu Feb 04, 2010 9:57 am    Post subject: Reply with quote

Hi all,

I also have somthing with the char FEFF, I don't know why...

The problem is a one-line space on the top (If I save the viewved page and open it with vim, I see <feff> just after <body>)

I work with ssh and editing with vim, but I m a beginner in file encoding

I just noticed than if I comment the "session_start()" thing, the space disappear, but my scripts files are supposely to be in utf-8 ..

Can someone help me ?
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP