MyBB Community Forums

Full Version: Warning [2] Headers already sent - Encoding issues with Language Installations
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've combed the forum for a solution to this header error and I cannot figure out what the problem is. Here is what I get, and here is what I tried:

I just installed a Spanish Language Pack. When I went back to my forums, I see this in the header of most pages:

Quote:Warning [2] Cannot modify header information - headers already sent by (output started at /home/start/public_html/forums/inc/languages/espanol.php:1) - Line: 1604 - File: inc/functions.php PHP 5.2.14 (Linux)
File Line Function
PHP errorHandler->error
/inc/functions.php 1604 header
/inc/functions.php 1665 my_setcookie
/inc/functions_indicators.php 154 my_set_array_cookie
/forumdisplay.php 1155 mark_forum_read

Here is what I did:

1. I looked for any whitespace or extra line breaks in espanol.php. There was none, and particularly nothing before <?php.
2. I am not using Notepad. I'm on a Mac, and the original file was loaded into my editor as a UTF-8 (No BOM) file.
3. I deleted .inc/settings.php to see if it would correct any internal settings
4. I removed all blank lines from espanol.php, just to be sure there wasn't one byte in the file that was being seen as a byte of output.
5. I tried uploading a fresh espanol.php again.

Update: I made a little headway, but I can't solve the problem still, because solving the first part creates another problem. Ok, so I noticed when I changed the encoding of espanol.php to "Western", the forum works fine, but the language selection box in the footer shows a very weird character in place of the "tilde N" (which is a non-Western character)

So why doesn't the forum work if the espanol.php file is in UTF-8 mode? What is causing the headers to pick up data output from such an encoded file?

On the other hand, is it possible to use UTF-8 encoded files at all? Do I have to resort to using a Western encoded file, and simply remove any offending characters in place of a Western equivalent?

Here is a copy of espanol.php. Notice the "ñ" character. In my browser, it shows up as a diamond with a question mark in it--clearly an unrecognized char for the encoding format of the MyBB page.

<?php
/**
 * MyBB 1.6 Spanish Language Pack
 * Copyright 2010 MyBB Group, All Rights Reserved
 * 
 * $Id: espanol.php 5016 2010-08-10 12:28:33Z Anio_pke $
 */

// The friendly name of the language
$langinfo['name'] = "Español (Internacional)";

// The author of the language
$langinfo['author'] = "SoporteMyBB";

// The language authors website
$langinfo['website'] = "http://www.soportemybb.com/";

// Compatible version of MyBB
$langinfo['version'] = "1600";

// Sets if the translation includes the Admin CP (1 = yes, 0 = no)
$langinfo['admin'] = 1;

// Sets if the language is RTL (Right to Left) (1 = yes, 0 = no)
$langinfo['rtl'] = 0;

// Sets the lang in the <html> on all pages
$langinfo['htmllang'] = "es";

// Sets the character set, blank uses the default.
$langinfo['charset'] = "UTF-8";
?>

Here is what happens when the UTF-8 file is saved as Western, just to prevent MyBB from throwing header output errors:
[attachment=20694]

This obviously becomes an issue if I want to use Chinese or Hebrew, because there is simply no Western equivalent for representing Eastern char encodings.

Thank you!
Steve

Has anyone dealt with Unicode issues yet? Isn't anyone running a forum that utilizes two different character sets? How are you getting your language files to show the proper character encodings without causing header errors? Is this possibly a bug for MyBB in not handling Unicode properly?

It doesn't make sense that if my language file is encoded in UTF-8, and the page encoding on the browser is UTF-8, a header output error occurs. Yet as soon as I change the file encoding to "Western", all works fine, no header output exceptions are thrown, but in return I have to settle with a language selection prompt showing non-sensical single-bit symbols in place of the desired double-bit encoded characters, like the ñ.

Somebody? Anybody?! :-)
Edit

$langinfo['charset'] = "UTF-8";

to:

$langinfo['charset'] = "utf-8";



-------
no se porque...pero edite eso y funciono a la perfección....
Wow! Muchas gracias, Zedkin! I was getting so frustrated. But every page now functions perfectly, and the language selection bar shows the tilde!

Ciao, y gracias otra vez,
Steve

(2010-12-10, 06:24 AM)zedkin Wrote: [ -> ]Edit

$langinfo['charset'] = "UTF-8";

to:

$langinfo['charset'] = "utf-8";


-------
no se porque...pero edite eso y funciono a la perfección....