Date: Illegal recode request '%a %b %d %H:%M:%S %Y..UTF-8'

ppruett

Joined: 2005-06-22
Posts: 9
Posted: Wed, 2005-06-22 05:42

basic install - all seems okay but date,
seems to have issues getting unix date and reformating, recode...
get error message instead of date.

date gets php error message like:
Warning: Illegal recode request '%a %b %d %H:%M:%S %Y..UTF-8' in /............/gallery2/modules/core/classes/GalleryPhpVm.class on line 81


Gallery URL (optional):http://www.cocoavillage.com/gallery/
Gallery version:gallery2beta3
Webserver (with version):Apache/1.3.29 (openbsd fixed)
Datatabase (with version):mysql-server-4.0.18p1 multithreaded SQL database
PHP version (eg 4.2.1):php4-core-4.3.5RC3
phpinfo URL (optional):www.cocoavillage.com/php.php
Graphics Toolkit(s):
Operating system:openbsd 3.6
Web browser/version:firefox
G1 version (for migration bugs):

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-06-22 06:33

ppruett, could you upgrade to the current nightly snapshot of G2 and check if the problem persists.
http://galleryupdates.jpmullan.com

 
ppruett

Joined: 2005-06-22
Posts: 9
Posted: Wed, 2005-06-22 14:48

used this mornings current, 2am june 22, 2005, and extracted fresh (no overlay) then added beta3 config.php file... then ran upgrader it said successfull...

of interest I only had one picture, and it may have got erased, not biggie for me.. but it may have happened because i did not 'overlay' but used fresh extraction... but that is a separate issue that I really am not worried about...
the date problem persists with current and my platform
http://www.cocoavillage.com/gallery/

Possibly openbsd unix uses different syntax when calling date?
http://www.openbsd.org/cgi-bin/man.cgi?query=date

?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Thu, 2005-06-23 02:17
Quote:
of interest I only had one picture, and it may have got erased, not biggie for me.. but it may have happened because i did not 'overlay' but used fresh extraction... but that is a separate issue that I really am not worried about...

It shouldn't have if you used the same database and g2data directory as your first install.

Quote:
the date problem persists with current and my platform
http://www.cocoavillage.com/gallery/

Of course it does. It's using some old code where this was obviously fixed in a newer version. You can safely move your new install over your old install or just delete your old install.

For future reference, you can just overwrite an existing install with a new one. The only file you really need is config.php, you also need .htaccess if you use the URL rewrite module. Gallery does not ship with either of these 2 files, so it's safe to do an upgrade by overwriting the existing files.

 
ppruett

Joined: 2005-06-22
Posts: 9
Posted: Thu, 2005-06-23 03:19

SKIP the whole upgrade issue! doing virgin current!

I just rm -rf g2data, gallery2 folders
and dropped the mysql database

I went to suggested site and grabbed
G2/current.gallery2.tar.gz 5679K
06-22-2005 03:36:13 AM

I INSTALLED VIRGIN. per installer

AND DATE PROBLEM STILL EXISTS.
THE PROBLEM HAD NOTHING to do with OLD CODE.
It may be a setting issue, a version of php, a version of apache,
a date command issue most likely... The web server is using OPENBSD 3.6
which is BSD based, not gnu or linux.... I have not tried to unravel how
G2 grabs date and recode, btw, BSD unices tend to use different syntax
than GNU for many commands but if using php for date how would that matter...

ANYRATE, I am back to - what next if you want me to help you debug G2 for a openbsd platform.

 
ppruett

Joined: 2005-06-22
Posts: 9
Posted: Thu, 2005-06-23 06:32

I put debug to buffered and did some greps and found this

./layouts/matrix/templates/albumBody.tpl:
{g->date timestamp=$layout.item.originationTimestamp}

but thats only a start.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-06-23 12:23

i informed one of the other devs, maybe he has more knowledge about this recode stuff.
in the meantime, you can query google and the php bug database (php.net, upper right corner) for php / openbsd / recode issues.

 
hamba

Joined: 2005-06-25
Posts: 54
Posted: Sun, 2005-06-26 00:01

Hi

I have the same problem here

 Date:
Notice: iconv(): Wrong charset, cannot convert from `%a %b %d %H:%M:%S %Y' to `UTF-8' in /htdocs/postnuke/html/modules/pnGallery2/gallery2/modules/core/classes/GalleryPhpVm.class on line 58

Warning: mb_convert_encoding(): Illegal character encoding specified in /htdocs/postnuke/html/modules/pnGallery2/gallery2/modules/core/classes/GalleryPhpVm.class on line 72
06/25/05 

I am also running it on openBSD

Gallery URL -- http://gitana.no-ip.org/postnuke/html/modules/pnGallery2/gallery2/
Gallery version -- gallery2beta3 (G2/current.gallery2.zip 06-25-2005 03:33:59 AM)
Webserver -- Apache Version: Apache/1.3.29
Datatabase -- mysql-server-4.0.20
PHP version -- PHP Version 4.3.11
phpinfo URL -- http://gitana.no-ip.org/phptest.php
Operating system -- openbsd 3.6
Web browser/version -- firefox

Cheers
Hamba

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-06-26 00:08

hamba, maybe it's related, but not the same issue.
recode()vs. iconv()

 
hamba

Joined: 2005-06-25
Posts: 54
Posted: Sun, 2005-06-26 00:19

can you please give me more info on this and mabe how to solve it

At the moment I have it installed as a standalone syustem
When I get this sorted I want to migrate it into postnuke

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-06-26 00:27

currently i don't have time to debug these issues.
we fixed similar issues (mb_convert_encoding) about a month ago, but obviously we didn't catch all possibilities.
if you do a forum search for mb_convert_encoding etc. you probably find the other threads and how we tried to debug it then.

maybe another dev has time to debug this, but i fear we are all very busy at the moment.

you should file a bug report at sf.net/projects/gallery/ if the problem persists and it looks like this thread gets forgotten.

 
hamba

Joined: 2005-06-25
Posts: 54
Posted: Sun, 2005-06-26 01:25

Hi

Just an update

I got it fixed by editing GalleryCharsetHelper_simple.class

I changed
$sourceEncoding = @$phpVm->nl_langinfo(CODESET);
to
$sourceEncoding = 'ISO-8859-1';

as was mentioned in http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=30431&postdays=0&postorder=asc&start=15
by RobFerrer

now it al seems to be working

Cheers

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-06-26 11:09

cool.

could you check what nl_langinfo(CODESET); actually returns on your setup?
you could just test it in a mini php script, e.g. test.php with the following contents.
<?php
$foo = nl_langinfo(CODESET);
print "<pre>";
var_dump($foo);
print "</pre>";
?>

 
hamba

Joined: 2005-06-25
Posts: 54
Posted: Sun, 2005-06-26 19:28

Hi

Here is the output you asked for

string(20) "%a %b %d %H:%M:%S %Y"

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-06-26 19:54

now that's what i call weird.

the output on my box is:
string(14) "ANSI_X3.4-1968"and i have no problems.

 
hamba

Joined: 2005-06-25
Posts: 54
Posted: Sun, 2005-06-26 21:57

ok I did a search for nl_langinfo under openbsd

and found this

this is links to the man pages on www.openbsd.com

nl_langinfo
http://www.openbsd.org/cgi-bin/man.cgi?query=nl_langinfo&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html

and
setlocale
http://www.openbsd.org/cgi-bin/man.cgi?query=setlocale&sektion=3&arch=i386&apropos=0&manpath=OpenBSD+Current

maybe it helps as I have know idea about this stuff

 
ppruett

Joined: 2005-06-22
Posts: 9
Posted: Mon, 2005-06-27 16:01

Before trying the above to see if it fixed my date recode issue aslo, I just updated to current this morning - 27june2005
and problem perists

So now I tried the above suggested change...
THAT FIXED my date recode problem

SHOULD WE report this as a bug?
It needs to be resolved before G2 release for BSD style unices.

notes-

in GalleryCharsetHelper_simple.class
I commented the following line, and forced value for $sourceEncoding and the date went away so OpenBSD and other BSD unices may have similar issues as FreeBSD

/* FreeBSD may return charset with missing hyphen from nl_langinfo */
// $sourceEncoding = str_replace('ISO8859', 'ISO-8859', $sourceEncoding);
$sourceEncoding = 'ISO-8859-1';

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2005-06-28 16:33

That value for CODESET is just plain wrong.. it looks like a date format, not a character set. We do remap a few bad charset values some systems spit out, but this one is too weird. Instead I'm adding a way for you to hardcode a system charset without modifying G2 code.. update to tomorrow's nightly snapshot and put this in your config.php:

require_once(dirname(__FILE__) . '/modules/core/classes/GalleryCapabilities.class');
GalleryCapabilities::set('systemCharset', 'ISO-8859-1');

(or whatever value works for your system).
I'll add a FAQ entry about this..

 
ppruett

Joined: 2005-06-22
Posts: 9
Posted: Fri, 2007-02-23 02:22

BTW, this fix does still work. Funny how we can forget painful memories,
I just was going through a gallery2 embed on an upgraded server to OpenBSD 4.0 with ports,
and the stable gallery2 had this issue, a google found this posting...
My posting :)

So put the following lines in the top of config.php as suggested, and it did fix
also. Quite a senior moment to re-google an answer you already got a year ago.

require_once(dirname(__FILE__) . '/modules/core/classes/GalleryCapabilities.class');
GalleryCapabilities::set('systemCharset', 'ISO-8859-1');