I just installed G2 B3 from scratch, and I get this message on the main page:
Date:
Warning: mb_convert_encoding(): Illegal character encoding specified in /home/rdehler/raybdbomb.com/photos/modules/core/classes/GalleryPhpVm.class on line 70
05/18/2005
Size: 0 items
Owner: Gallery Administrator
It's located at http://raybdbomb.com/photos
----
Gallery URL (optional):http://raybdbomb.com/photos
Gallery version:G2B3
Webserver (with version):Apache 2.0.54
Datatabase (with version):Mysql 4.1.11
PHP version (eg 4.2.1):4.3.11
phpinfo URL (optional):
Graphics Toolkit(s):GD, NetPBM
Operating system:FreeBSD 5.4
Web browser/version:Mozilla/IE/Doesn'tMatter
G1 version (for migration bugs):n/a
Posts: 32509
Raybdbomb2, thanks for reporting that.
Could you edit the file /home/rdehler/raybdbomb.com/photos/modules/core/classes/GalleryPhpVm.class with a (text) editor?
Before line 70 (just before return mb_convert_encoding($string, $outCharset, $inCharset);), could you add this:
then save the file with this change.
and activate 'buffered' debug mode in config.php (open config.php in an editor and find the line to change the debug mode).
then, browse around in g2 to cause this warning.
in the debug output, search for the string "mb_convert_encoding" and post the complete string mb_convert_encoding(..., ... , ...); to the forums.
then perhaps we can find the problem.
i just tested what i've described it, but i didn't get any mb_convert debug output. not sure what causes main.php to use this function, at least you should get some debug output...
Posts: 8601
I don't see any warning on that page.. is it resolved? If not, does it appear only when logged in? What language have you selected?
Posts: 3
This is on Solaris 9/PHP 4.3.10, So YMMV.
The problem is with nl_langinfo(). It was returning '646' as the locale, which mb_convert_encoding() doesn't understand as a valid codeset. This didn't make any sense because my locale should be ASCII, but then I found out the ISO_646 is an alias for the ASCII codeset. As a workaround, I changed the nl_langinfo() function in modules/core/classes/GalleryPhpVm.class to:
function nl_langinfo($item) {
if (nl_langinfo($item) == '646') {
return "ASCII";
} else {
return nl_langinfo($item);
}
}
Posts: 32509
USFeric, thank you, this is very useful debug information. the question is now if '646' is a valid abbreviation for 'ISO_646' or if solaris or your solaris does return something invalid.
Posts: 8601
USFeric, search for "Remap some known charset issues" in modules/core/classes/helpers/GalleryCharsetHelper_simple.class
Let us know if putting a case '646' here does the trick.. if so we can add that to cvs.
Posts: 3
mindless,
that 'switch' statement is inside the 'else' block which begins on line 55, so it never gets run if the nl_langinfo() function exists. When I take the 'switch' statement out of the 'else' block (closing the 'else' block on line 76 instead of 93), and add a case for 646, it works. Hope that makes sense.
Posts: 8601
it makes sense to map unusual nl_langinfo output too.. but let's add a separate "switch" inside that part of the if block; can you post your patch? thanks!
Posts: 14
valiant
thanks for the response.
I did as you said, and there was no reference to mb_convert_encoding in the debugging output.
I "fixed" it by just having the function return $string instead of the passthrough function.
It probably lost some functionality (that I don't use anyway most likely), but it's better than seeing an error.
Posts: 2
Hi all,
I just upgraded from B2 to B3 and the "Warning: mb_convert_encoding(): Illegal character encoding specified in /path/to/GalleryPhpVm.class on line 70" the only issue I had (I think).
So I followed valiant's advice to Raybdbomb2 and I was also unable to locate any reference to mb_convert_encoding.
I have been trying the other advice mentioned in the thread but so far I haven't gotten rid of the message.
This is running on 4.9-STABLE FreeBSD and PHP Version 4.3.x
Thanks for reading and please advise.
Rick
Posts: 8601
rickupusa, can you post what you changed?
did you successfully turn on debug output? (there will be lots of output)
Posts: 2
mindless,
Thanks for the reply.
I snagged http://raybdbomb.com/photos/modules/core/classes/GalleryPhpVm.class
and it is working so far so good.
I did successfully turn on buffered output but at this point I am happy and everyone seems to be aware that Solaris and FreeBSD seem to have this problem but I can provide more info if you want.
In fact, I have several FreeBSD 4.x with PHP 4.x and FreeBDSD 5.x with php5 servers I can test with so feel free to let me know if you want me to try anything else.
May I ask what OS Gallery2 developers generall use and test on?
Thanks again,
Rick
Posts: 8601
rickupusa, and anyone who sees this warning.. we'd much rather have you debug and find out what string your nl_langinfo or setlocale is returning so we can add a mapping in GalleryCharsetHelper_simple.. this will help out other people too!
Edit modules/core/classes/helpers/GalleryCharsetHelper_simple.class and add print or $gallery->debug statements to find out what $sourceEncoding it is getting.
FYI, I'm on freebsd 4.11 and don't have any warnings.
Posts: 33
Hi,
I'm having this problem with a fresh install of G2B3, running on Apache 1.3.33/FreeBSD 5.3/PHP 4.3.11.
See http://yuccgallery.fclusers.co.uk/ (buffered debugging on)
If you need any mor information please let me know
Thanks
Rob
Posts: 32509
RobFerrer, can you try the most recent nightly snapshot?
you can easily upgrade to it, see the instructions in README.html and the FAQ.
http://galleryupdates.jpmullan.com
and if the problem persists, please edit gallery2/modules/core/classes/helpers/GalleryCharsetHelper_simple.class:
after
please add:
and after
$lcTable = explode(';', $phpVm->setlocale(LC_ALL, '0'));
please add:then turn on immediate (not buffered!) debug mode in config.php and let us see the output. (search for GalleryCharsetHelper in the output, we only need those lines . thanks.
Posts: 33
The latest build didn't help (although see below), so made the changes as requested.
I think the line you need is:
Which seems to be output once, the first time a date is displayed.
Probably unrelated, but I got an error message when updating:
I increased the memory limit and re-did that step and it all worked fine. Should I submit this elsewhere?
Thanks
Rob
Posts: 8601
Now try adding $sourceEncoding = 'ISO-8859-1'; in the code and see if that is the charset value it should be using.
Posts: 33
I replaced the line
$sourceEncoding = @$phpVm->nl_langinfo(CODESET);
with the line
$sourceEncoding = 'ISO-8859-1';
and it all seems to work now.
Posts: 32509
so, as a fix, we should normalize ISO8859-* to ISO-8859-* in GalleryCharsetHelper_simple::detectSystemCharset, right?
Posts: 33
I don't fully understand what this is all doing, but it looks like that would fix my problem anyway.
Posts: 32509
RobFerrer, don't think so. please update the other topic.
Posts: 8601
valiant, do you think we should have a separate "switch" for mapping nl_langinfo results, or move the existing switch outside that else block and put the new mapping there?
Posts: 32509
i'd add a
just before the GalleryDataCache::put($cacheKey, $sourceEncoding);
do you think that's too narrow, just looking for ISO8859?
Posts: 8601
that seems fine, catch any other -# suffixes in same check.. but i'd like to keep our mappings grouped together and well commented.. if you think it's ok, maybe move the existing switch outside that else block and put it next to this new bit you're adding.
Posts: 32509
mindless, it's ok if you do it ;)
seriously, i can't / shouldn't work on g2 1,2 days.
Posts: 8601
ok, change committed to cvs.
Posts: 33
Latest version from CVS works great for me.
Off topic I'm afraid, but I didn't have to run any upgraders - is that normal?
Thanks to everyone working on this project.
Rob
Posts: 32509
RobFerrer, great.
@upgrades: depends: if your last update was only a day ago or so, then this is normal. it starts the upgrader only for "major" upgrades, i.e. when we changed something in the core module that requires a database / config file / ... change.
Posts: 1
Forgive me for dredging this thread out of the archives.. I just installed everything on a Solaris9 box and had the same problem. Google led me here.
I did some debugging as requested above and fixed the problem. Here's the patch, if you wish...
Posts: 8
thanks Windsor
that fixed it for me as well on solaris 10
has this been applied?
Posts: 8601
yes.. this is not in 2.1.x, but it is in current svn/will be in 2.2