Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Confused about character encodings, help!


Oliwerko

Recommended Posts

Hi there everyone.

 

I've been trying to figure this out on my own but now I'm at loss.

 

I'm running osc 2.3.1 and there's no Slovak language for this version. So I just copied the English one, changed the character set in slovak.php to UTF-8, then went over all the language files and saved them in UTF-8 encoding. This worked until recently. I don't know what happened but now when I save a language file in UTF-8 I keep getting the "Cannot modify header information - headers already sent" error.

 

I switched back to ISO_8859-1 and re-saved all the language files in ANSI. However, characters with diacritics (e.g. ľ š č ť ž ý á í é,...) don't display correctly and give me black diamonds.

 

When I set the charset in slovak.php to UTF-8, text from database (i.e. product names) displays correctly, but text from language php files is screwed. When I set the charset to windows-1250, it is the other way around. If I set it to ISO_8859-1, all text is screwed up.

 

I checked the database, and funnily while most of the tables are in latin-1; tables "customers", "address book", "customers basket", and "customers info" are utf-8.

 

 

All I want is to have diacritics display correctly. What should I do? Is there any way around the "headers already sent" error? I'm confused. Any help is very much appreciated. Thanks.

 

(the eshop is here: https://eshop.hobbyart.sk:4443/)

Link to comment
Share on other sites

Headers already sent has nothing to do with character set, the error occurs because you are sending content prior to the html <head> it can be due to whitespace issues (content before or after the first or last <?php and ?> respectively) or other warnings/errors creating the same

 

In your browser use 'view source' check what appears before the head

 

Character encoding: The standard osC method of adding

<meta http-equiv="Content-Type" content="text/html; charset=

is not the best method to set charset your better adding a header within the php code prior to the head, like

header('Content-Type: text/html; charset=iso-8859-1');

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Especially check if your language file editing left a "Byte Order Mark" () at the beginning of a file. Note that when looking at the file in an editor, you need to make sure that you're not in UTF-8 display mode, or the BOM may be hidden from you. In general, the "Headings already sent" means that some content was already sent to the browser, which forced the flush (too early, as far as osC is concerned) of the default headers. This content could be as little as a single blank or a BOM.

Link to comment
Share on other sites

Thanks for replies guys!

 

The connection between headers already sent and charsets was in BOM. I got Notepad++ to be sure, converted all the files into UTF-8 without BOM and it displays everything correctly and works. Thanks for help!

 

Still, I wonder how come that it worked for a year and now just stopped and had to be changed.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...