Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Having troubles with "ÄÅÖ"


Recommended Posts

Hey, I'm having troubles with following letters "ÄÅÖ" at http://shop.saunaeverywhere.se/products_new.php?currency=SEK&page=3


When Saturday gets translated into Lördag the "Ö" doesn't work. Anyone knows how to fix this?


(products_new.php "TEXT_DATE_ADDED" )



And, when I change language the "Search" buttom at the right upper corner doesn't get translated.



I appriciate all help!

Link to comment
Share on other sites

The site labels appear to me in English, because my browser is set up to have English as its language. Unfortunately, I don't have Swedish installed on my browser so I can't check what it does there. The product description text appears to be in Swedish, with accented characters including å, ö, and ä:

Savotta 50, flaggskeppet! Då kom den efterlängtade tronföljaren till Savotta 906. Detta är.


The version is osC 2.3.1 and the page character encoding is UTF-8. Can you check whether the Swedish language files are UTF-8 or Latin-1? If they're Latin-1, that should give you ?-in-diamond invalid character marks for accented Swedish characters. Is the database UTF-8? Since it's pulling the product descriptions out of the database, if they went in as UTF-8 characters they should come out as UTF-8 characters, even if the database itself is still using Latin-1 (it won't convert them, it will just probably sort them incorrectly).

Link to comment
Share on other sites

Thanks for the response, I'm kinda new to OsCommerce, I found this line in the Swedish.php language file.


// charset for web pages and emails

define('CHARSET', 'utf-8');

Link to comment
Share on other sites

OK, the Swedish language file is telling the page to display in UTF-8. Now, what is happening with these characters that don't come out right? Are you seeing a "?-in-diamond" mark? That tells you that the text is probably still in Latin-1, which will cause a failure on any accented character. Do you know if the Swedish file came from osC with that line as UTF-8, or did someone change it from Latin-1 (ISO-88591-1) or something similar to UTF-8, without updating the accented characters in the file? There are utilities available that take a whole file in one encoding and change it to another encoding.


As for the Search button, unlike the other buttons on the line, this one is a graphic (PNG file), and it's pulled from a fixed location rather than a language directory. Is this search coming from the base osC (I suspect not), or an add-on you added, or with the theme/template? Your template probably was written for English and not carefully designed to handle other languages. The template code will have to be modified to pull the graphic from a language-dependent directory (e.g., an include/languages/swedish/images/ directory), and of course, someone will have to use an image editor to create a new button or modify a copy of the old to use Swedish text. If you purchased this template, did it include the Swedish text library? If so, I would suggest to the seller that they didn't complete the job. It also would be possible to modify the code so as to use text drawn from a language file, rather than a pure graphic.


Add: One other possibility on the bad characters, if they're only in the day of the week. It's possible that your PHP library is outputting the weekday in Latin-1, while your page is trying to display it in UTF-8. You might ask your host if they have any suggestions for how to ensure that PHP outputs text such as the weekday in UTF-8. It may be as simple as adding a line to (or fixing) the Swedish language file to declare the locale as se_SE.UTF-8 or something like that. There needs to be a place to tell PHP to use Swedish for words, and use UTF-8 for the encoding. Is there a "locale()" call in your files? Has it too been changed to UTF-8?

Link to comment
Share on other sites

Hey and thanks again for the answer.


It looks like this. I don't know how it looked after the install of Oscommerce since I didn't install it.




The search buttom are in a PNG format, but there is only one (English version) So If i simply exchange the english version, the search buttom will be only in Swedish, and I would want it to be in both english and swedish.

Link to comment
Share on other sites

Yes, if you simply replace the English "Search" button by a Swedish "Sök" button, your English users will be left wondering what that is (wonderful opportunity to teach them Swedish, I guess!). What's going to have to happen is someone update the PHP code for the Search function so that instead of grabbing the button image from a fixed place (layout/images/h_search_btn.png), it would get the correct copy depending on the language (includes/languages/{language used}/images/h_search_btn.png).


If you paid for this template, and no one told you that it was English-only, I think you would have a case to go to the seller and ask them to update the template to support multiple languages. It may be a bug on their part that they forgot to handle the Search button graphic, while enabling all the text handling to use the correct language. If they don't owe you any support (free template, or you modified it yourself, or they clearly said "English only"), you'll have to either do it yourself or hire someone to do it.


Regarding the bad accented characters, this is only for weekdays? How about month names? My guess is that your PHP library is (by default) returning the string in Latin-1 encoding, which then fails when you display it in UTF-8. In your includes/languages/swedish.php file, there should be a setlocale() call. Does yours look something like

@setlocale(LC_TIME, 'se_SE.ISO_8859-1');

? If so, it's telling PHP to output the weekdays in Latin-1. Try instead

@setlocale(LC_TIME, 'se_SE.UTF-8');


Check to see if there are any other setlocale() calls you need to deal with. For English, it doesn't really matter if it returns Latin-1, but for other languages it usually will matter.

Link to comment
Share on other sites

OK - This is how i got it to work - IT WORKS!!!!




see this link first:




I use both english and spanish (could be other combo)


My english.php and espanol.php in ..includes/languages/ are:


english.php espanol.php


@setlocale(LC_TIME, 'en_US.UTF-8'); @setlocale(LC_TIME, 'es_ES.UTF-8');


define('CHARSET', 'utf-8'); define('CHARSET', 'utf-8');



define('HEADER_TITLE_CREATE_ACCOUNT', 'Create an Account'); or

define('HEADER_TITLE_CREATE_ACCOUNT', 'ñ ó í á'); //typed as you would


my sql server is UTF-8


From the link above, using notepad++ simply saved it as utf-8 without BOM.

worked perfectly!


NOTE: change the es_ES.UTF-8 for other e.g: @setlocale(LC_TIME, 'xx.XX.UTF-8');

DO NOT CHANGE: define('CHARSET', 'utf-8');


passed the html validation and totally solved my issue.


hope this helps


note: i check all my pages in the language file quickly in notepad++ there weere only one or two pages other than

the above page. (was going crazy trying to figure this out).

Link to comment
Share on other sites


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

  • Create New...