Welcome to Geeklog, Anonymous Friday, March 24 2023 @ 06:18 am EDT

Geeklog Forums

How to fix wron charset for date output on windows-based servers.


Status: offline

Martinez

Forum User
Newbie
Registered: 10/19/04
Posts: 7
Location:Poland - Zakopane

Hi.

For some people this topic could be funny, but some have no other choice and must use windows-based servers (like me).


Gettin' to the point - in windows-based servers function for formatting date gives at output wrong charset, when using language other, than set in config.php.


Here is my propose to fix this issue:

in file lib-common.php, function COM_getUserDateTimeFormat():


currently line to fix looks like this:

Text Formatted Code

    // Format the date

    $date = strftime( $dateformat, $stamp );

    return array( $date, $stamp );
}

 


After my fix it shuld look like this:

Text Formatted Code

    // Format the date

    $date = iconv( '', $_CONF['default_charset'], strftime( $dateformat, $stamp ) );

    return array( $date, $stamp );
}

 


This eliminates (I think - it works for me with GL 1.3.10rc1) wrong charset for formatted output of the date.

Maybe someone have some time to change my propose, to make it independed from conversion utility (not all people uses iconv).


Best regards

 Quote

Martinez

Anonymous

Hi again!


After long-term analysis of source code of geeklog and studying PHP docs I've considered, that this issue is done by function strftime() from PHP library. This function converts timestamp to string-formated date. But it returns this string in system-depended format, and charset.

To fix this my propose is to paste this function into lib-custom.php:

Text Formatted Code
function timeconv( $time ) {
        global $_CONF, $_TABLES, $LANG01, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS;
        $retval=iconv( '', $_CONF['default_charset'], strftime( $time ));
        return $retval;
}

 

and change all calls to strftime function into timeconv function call. This should completly eliminates wrong charsets from output Smile


Enjoy and best regards

 Quote

All times are EDT. The time is now 06:18 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content