Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Date coding


Antonin

Recommended Posts

Posted

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

Posted

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

Posted

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.

Posted

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

Posted

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

Posted

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.

Posted

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

Posted

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

Posted

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

Archived

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

×
×
  • Create New...