CodeIgniter Forums
UTF-8 Latin 1 etc... I moved to linux and nothing seems to work properly - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: UTF-8 Latin 1 etc... I moved to linux and nothing seems to work properly (/showthread.php?tid=2791)



UTF-8 Latin 1 etc... I moved to linux and nothing seems to work properly - El Forum - 08-24-2007

[eluser]snaggy[/eluser]
This is a problem I hadn't encountered in windows, in my pages written in italian with italian special characters such as òàùèì that show up as question marks...

I don't know if I should use UTF-8 or Latin 1, can you suggest me which one should I use (easiest one)?

I have a database in MySQL in which I can choose the collation... what to pick?

In codeigniter my php files are encoded as UTF-8 I think, this is what Zend creates when I make a new file.

In my view files charset can be set to either UTF-8 or ISO-8859-1

The point is that with every possible combination it doesn't seem to work. If I use Latin 1 as I did on windows firefox reads it as utf all the same, dunno why:
Code:
<html>

<head>
<title>My Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Language" content="it">
</head>

<body>

<p>questa � la home page</p>

&lt;/body&gt;

&lt;/html&gt;


even if the php files is encoded in latin 1 (does this matter?)

I'm really confused, can anyone help or at least tell me what he/she does so that I can copy?

thanks!
Bye


UTF-8 Latin 1 etc... I moved to linux and nothing seems to work properly - El Forum - 08-24-2007

[eluser]#1313[/eluser]
I work with cyrillic symbols. My database collation is UTF-8, my html charset is UTF-8, my files are stored in UTF-8 and my first query after connecting to database (i do it my models which work with database) is SET NAMES 'utf8';


UTF-8 Latin 1 etc... I moved to linux and nothing seems to work properly - El Forum - 08-24-2007

[eluser]tobben[/eluser]
Also set the text encoding to UTF-8 in the text editor you are using.

Using &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt; on the webpage, but saving the file with UTF-8 encoding, or vice versa, would make æøå to som nasty looking chars.


UTF-8 Latin 1 etc... I moved to linux and nothing seems to work properly - El Forum - 08-24-2007

[eluser]Crimp[/eluser]
The trick is to keep whatever you choose consistent throughout. http headers seem to be missing from what's been mentioned already.


UTF-8 Latin 1 etc... I moved to linux and nothing seems to work properly - El Forum - 08-24-2007

[eluser]snaggy[/eluser]
Fantastic, the SET NAMES thing did the trick!

By the way Crimp, if I add a header function with the content type, it gives an error saying that's already being passed by the parser,, but in the parser lib I can't find it. Does it matter? It's working all right right now

thanks


UTF-8 Latin 1 etc... I moved to linux and nothing seems to work properly - El Forum - 08-24-2007

[eluser]snaggy[/eluser]
I'm sorry but I got another problem!! I'm starting to feel hopeless...

just about headers..

Code:
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /var/www/Aleon/system/application/libraries/MY_Parser.php:86)

Filename: helpers/url_helper.php

Line Number: 459

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /var/www/Aleon/system/application/libraries/MY_Parser.php:86)

Filename: libraries/Session.php

Line Number: 364

What is this about! I'm not passing any header by the Parser (template) I think, I never used the header() function

any idea? I tried to look at the code and I saw that the headers are passed for the coockies (session manager) and the redirect function (URL helper)

bye


UTF-8 Latin 1 etc... I moved to linux and nothing seems to work properly - El Forum - 08-24-2007

[eluser]Crimp[/eluser]
Set your default charset in the php.ini instead:

http://www.usphp.com/ini.core.html

Your errors usually happen when you echo something before loading the view. Check if you left some debugging echoes in your parser file.


UTF-8 Latin 1 etc... I moved to linux and nothing seems to work properly - El Forum - 08-25-2007

[eluser]snaggy[/eluser]
No idea why, but if under linux i use the simplelogin library or anything that writes headers/coockies after having loaded the parser library it crashes...

I decided to split it into 2 controllers and it works fine, but I would like to know why that happened nevertheless.

bye!