CodeIgniter Forums
[HELP] UTF-8 file gives me a headache - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: [HELP] UTF-8 file gives me a headache (/thread-21158.html)



[HELP] UTF-8 file gives me a headache - El Forum - 08-01-2009

[eluser]Las3r[/eluser]
Hi there everyone,

For my website i basically have a lang.en.php file in root/translations/lang.en.php

I include this file in every controller, and it contains lines like:
Code:
define('WELCOME',   'Welcome back'  );
define('ADMIN_PANEL_OVERVIEW','Administration panel overview');
define('NEWS_MANAGER','News Manager');

This works fine and it nicely shows me the actual text in the views when i load them.

HOWEVER:

In order to translate the admin panel to greek (utf-8), I tried to convert the lang.php document to utf-8 with notepad++, and uploaded it as lang.gr.php.

(note: If i don't change it to utf-encoded php file, the website will show trash, regardless of a header content type set as utf-8 or not (!)).

With the identical file (but UTF-8 rather than ANSI) Codeigniter spits me the message "Warning headers already sent" on a redirect-page. Wtith the exact same file in english but ANSI this doesn't happen.

Does anyone has any idea how this comes, and how can I can find a solution for this other than:

Code:
ΘΘΙΞΞ
ΘΘΙΞΞ

Regards,

Erik


[HELP] UTF-8 file gives me a headache - El Forum - 08-01-2009

[eluser]Eric Barnes[/eluser]
I think the problem is a hidden character just before the opening php in the file. I ran into this before and the only way I could fix it was to recreate the file starting with UTF-8.


[HELP] UTF-8 file gives me a headache - El Forum - 08-01-2009

[eluser]pistolPete[/eluser]
Have a look at this thread: forums/viewreply/587937/

By the way: CodeIgniter already has a language class: libraries/language.html
Quote:The Language Class provides functions to retrieve language files and lines of text for purposes of internationalization.



[HELP] UTF-8 file gives me a headache - El Forum - 08-01-2009

[eluser]Las3r[/eluser]
I had the same issue before, and the problem was some kind of whitespace AFTER the ?> tag. But i am sure it doesnt have that now Smile

Regards,

Eri9k


[HELP] UTF-8 file gives me a headache - El Forum - 08-01-2009

[eluser]Las3r[/eluser]
Pete - that worked, thank you!

REgards,

Erik