Antonin Posted October 5, 2011 Posted October 5, 2011 Hi, would you know what to do to avoid displaying these characters:�� in my date? I want to have there proper letters. The language coding for my web page is Czech, this I have managed. But I have no clue where to do and what to do to set the right coding also for date. It bothers very much, every page with a date has this problem. Thank you. Antonin
Guest Posted October 5, 2011 Posted October 5, 2011 In the language file, change this: // charset for web pages and emails define('CHARSET', 'utf-8'); to this: // charset for web pages and emails define('CHARSET', 'iso-8859-1'); Chris
MrPhil Posted October 5, 2011 Posted October 5, 2011 I wouldn't think that Czech language files would be encoded in Latin-1 (Western European). Are you sure? Can someone confirm just what encoding they use? What are the mystery boxes supposed to be -- a month name or abbreviation, or some punctuation characters? The first order of business would be to find what the language files were actually encoded in, and whether they're all consistent (same encoding). If they are, does it match what the database is defined to be? It's possible that the offending characters are not part of the language files themselves, but rather, hard-coded punctuation characters (such as << >>) in a code or theme file that were entered in (usally) Latin-1, when HTML entities should have been used.
foxp2 Posted October 5, 2011 Posted October 5, 2011 same issue with french. bug fix is here : http://www.oscommerce.com/forums/tracker/issue-160-utf-8-with-native-php-date-functions-on-iis-server-are-not-supported/
Guest Posted October 5, 2011 Posted October 5, 2011 I wouldn't think that Czech language files would be encoded in Latin-1 (Western European). Are you sure? Can someone confirm just what encoding they use? What are the mystery boxes supposed to be -- a month name or abbreviation, or some punctuation characters? The first order of business would be to find what the language files were actually encoded in, and whether they're all consistent (same encoding). If they are, does it match what the database is defined to be? It's possible that the offending characters are not part of the language files themselves, but rather, hard-coded punctuation characters (such as << >>) in a code or theme file that were entered in (usally) Latin-1, when HTML entities should have been used. I can confirm is works with French and Spanish and can easily be checked with other languages as it is a quick code edit. Chris
foxp2 Posted October 6, 2011 Posted October 6, 2011 unrelated to charset ! eg, same issue in product_info.php (with oscommerce 2.2.x) with native charset iso-8859-1: <?php } if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) { ?> <tr> <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td> </tr> <?php } else { ?> <tr> <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td> </tr> <?php } ?> because tep_date_long function uses native strftime php function : // Output a raw date string in the selected locale date format // $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS function tep_date_long($raw_date) { if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return false; $year = (int)substr($raw_date, 0, 4); $month = (int)substr($raw_date, 5, 2); $day = (int)substr($raw_date, 8, 2); $hour = (int)substr($raw_date, 11, 2); $minute = (int)substr($raw_date, 14, 2); $second = (int)substr($raw_date, 17, 2); return strftime(DATE_FORMAT_LONG, mktime($hour,$minute,$second,$month,$day,$year)); } doc : http://php.net/manual/en/function.strftime.php
MrPhil Posted October 6, 2011 Posted October 6, 2011 I can confirm is works with French and Spanish and can easily be checked with other languages as it is a quick code edit. French and Spanish are "Western European" languages, written in Latin-1 (ISO-8859-1). Czech is a Central/Eastern European language which uses characters not found in Latin-1. I guarantee that changing the page to Latin-1 will break it. Besides, if the language pack is specifying UTF-8, dollars-to-doughnuts that's what the Czech text is written in. Laurent sounds like he may be on to something.
Guest Posted October 6, 2011 Posted October 6, 2011 French and Spanish are "Western European" languages, written in Latin-1 (ISO-8859-1). Czech is a Central/Eastern European language which uses characters not found in Latin-1. I guarantee that changing the page to Latin-1 will break it. Besides, if the language pack is specifying UTF-8, dollars-to-doughnuts that's what the Czech text is written in. Laurent sounds like he may be on to something. You may be right Phil. I have never done a Czech site before so I am not POSITIVE about the CHARSET. Chris
Antonin Posted October 6, 2011 Author Posted October 6, 2011 French, Spanish are LATIN 1. Central European languages - not cyryllic (also the Microsoft calls them so) like Czech or Slovak are coded with the what is called LATIN 2, utf 8, iso 8859-2. How to solve this? It lowers the value of my work. Thanks. Antonin
multimixer Posted October 6, 2011 Posted October 6, 2011 Can you post following line from your includes/languages/czech.php file? @setlocale(LC_TIME, 'en_US.ISO_8859-1'); How does it look like? You could also try this while being at the file @setlocale(LC_TIME, 'cs_CZ.utf8'); and a related link My community profile | Template system for osCommerce - New: Responsive | Feedback channel
Antonin Posted October 6, 2011 Author Posted October 6, 2011 The second one helped. My setting was: @setlocale(LC_TIME, 'cs_CZ.ISO_8859-2');, I just have overwritten the default setting, which was bad. I have spent a lot of time looking for the way out of this. Thank you very much. Have a nice day, as I have it from now on. Antonin
multimixer Posted October 6, 2011 Posted October 6, 2011 Glad that it work, was not sure it was the right thing to do either :) But you can have a nice day even without the right @setlocale, not? :) My community profile | Template system for osCommerce - New: Responsive | Feedback channel
Recommended Posts
Archived
This topic is now archived and is closed to further replies.