Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Files not saved as UTF-8 (maybe error not bug)  (Read 330 times)

blankspace

  • Newbie
  • *
  • Karma: 3
  • Posts: 22
Files not saved as UTF-8 (maybe error not bug)
« on: June 23, 2012, 02:06:17 PM »

When I first download sNews and try her out, I notice one strange thing. When write for example with key combination, it always turned out wrong (missing character symbol), even tho my database is utf-8 general_ci collation and it says utf-8 in sNews admin, index.php etc. So should work, no? Then I check file encoding in my editor for files snews.php, index.php and lang.php and they all are in ISO-Latin 1 encoding! This is not so good.

If to write special characters like , @, , etc with key combination and not html entity, important files must be changed to UTF-8 encoding!

I also see many questions in this forum saying problem with UTF-8 this, problem with UTF-8 that ... perhaps this is one reason why.

Ciao,
/Pax
Logged
All your internets are belong to us

skian

  • Full Member
  • ***
  • Karma: 14
  • Posts: 120
Re: Files not saved as UTF-8 (maybe error not bug)
« Reply #1 on: June 23, 2012, 03:28:41 PM »

Try this : http://snewscms.com/forum/index.php/topic,10349.msg68601.html

I don't know why it's still not in the distribution
Logged

blankspace

  • Newbie
  • *
  • Karma: 3
  • Posts: 22
Re: Files not saved as UTF-8 (maybe error not bug)
« Reply #2 on: June 24, 2012, 12:41:34 PM »

Hello skian!

Yes, the solution you link to is good and takes care of the problem of forgetting to set collation value in database. But it is not what I am talking about, it is - how you say - the other side of the money. Because even if you have UTF-8 set as collation value for database special characters like can still become the "missing character" symbol if your files are encoded with a different character set.

Also there is other, simple way of fixing charset problem for database. In file SQL, after the end } of every CREATE TABLE block, add this:
ENGINE=InnoDB  DEFAULT CHARSET=utf8 ;

of course we should do this before creating the database and importing SQL file, ha-ha.
But it is other solution than what I mean. Both are necessary I think, or we could still get problems with utf-8 characters.

Ciao
/Pax
Logged
All your internets are belong to us