[SOLVED] function.mb-convert-encoding

nightyy

Joined: 2005-01-25
Posts: 6
Posted: Thu, 2005-05-05 16:54

Hi, after installing the 05.05.05 nighty i get the following, have tried different collations already...
For any suggestions i'd be glad

Datum:
Warning: mb_convert_encoding() [function.mb-convert-encoding]: Illegal character encoding specified in C:\www\gallery\modules\core\classes\GalleryPhpVm.class on line 70
05/05/05
Anzahl: 0 Elemente
Besitzer/in: Gallery Administrator

----

Gallery URL (optional):
Gallery version:
Webserver (with version):
Datatabase (with version):
PHP version (eg 4.2.1): 5.04
phpinfo URL (optional):
Graphics Toolkit(s): gd2
Operating system: wamp
Web browser/version:
G1 version (for migration bugs):

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2005-05-05 20:05

it prints that on every page? does the page display correctly otherwise? you didn't mention which locale you're using, i gather de_DE?

 
nightyy

Joined: 2005-01-25
Posts: 6
Posted: Thu, 2005-05-05 20:39

Hi,
i switched to the beta2 which works perfectly.

It is displayed on every album but otherwise the page is fine.
I tried using english and german with gettext and without

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2005-05-05 22:55

what OS is "wamp"?
if you try a recent version again, try putting
print $locale;
at line 52 of modules/core/classes/helpers/GalleryCharsetHelper_simple.class (right after the $locale = line)
and let us know what it prints.

 
nightyy

Joined: 2005-01-25
Posts: 6
Posted: Fri, 2005-05-06 05:26

hi, wamp is:

windows xp pro sp2
apache 2.053
mysql 4.1.11
php 5.04

i will try that later although i got beta2 running meanwhile, but i will play the tester here :)

 
yaresse

Joined: 2005-04-10
Posts: 2
Posted: Sat, 2005-05-07 21:19

i get the same error on:

Gallery version = 2.0-beta-2+ core 0.9.16
PHP version = 4.3.10 cgi
Webserver = Apache/1.3.29
Database = mysqlt 4.0.18-log
Toolkits = ImageMagick, NetPBM, Gd, AlbumTestToolkit
Operating system = FreeBSD zirx.pair.com 4.8-STABLE FreeBSD 4.8-STABLE #0: Thu Apr i386
Browser = Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)

 
yaresse

Joined: 2005-04-10
Posts: 2
Posted: Sat, 2005-05-07 21:50

ok. i fixed it by changing the _setlocale function in the GalleryTranslator class

"ISO8859-1" should be "ISO-8859-1"

the other chartset probably also need to be changed.

 
virshu
virshu's picture

Joined: 2003-09-13
Posts: 314
Posted: Mon, 2005-05-09 21:45

could you please get the lates nightly, remove the changes that you made and see if the problem is still there. If it is you may report it here and/or also here: http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=29744

 
superbird

Joined: 2005-05-11
Posts: 5
Posted: Wed, 2005-05-11 19:23

I got the following warning message on my windows machine. I am running the code from CVS on 5/10 and my language setting is US english.

PHP 4.3.11
windows XP
apache 2.0.53

Warning: mb_convert_encoding(): Illegal character encoding specified in C:\xampp\htdocs\gallery2\modules\core\classes\GalleryPhpVm.class on line 70

After some debugging, I found that the third parameter to mb_convert_enconding is NULL so I change the GalleryPhpVm::mb_convert_encoding to

function mb_convert_encoding($string, $outCharset, $inCharset) {
if ($inCharset == NULL) {
return mb_convert_encoding($string, $outCharset);
} else {
return mb_convert_encoding($string, $outCharset, $inCharset);
}
}

the warning message disapeared.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2005-05-11 23:26

superbird, thanks for the tip.. I'm applying a fix further up in the code so we don't call this function with null $inCharset.. (calling mb_convert_encoding from mb's internal encoding was not our intention here).

 
superbird

Joined: 2005-05-11
Posts: 5
Posted: Thu, 2005-05-12 15:29

Mindless,

Sounds good. Please let me know when the fix is ready so I can apply it.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2005-05-12 17:58

went into cvs yesterday.. update from cvs or get the current nightly snapshot.

 
nightyy

Joined: 2005-01-25
Posts: 6
Posted: Fri, 2005-05-13 17:33

fine, quick fixes aound here :)

 
Ellipse

Joined: 2005-05-30
Posts: 2
Posted: Mon, 2005-05-30 08:21
virshu wrote:
could you please get the lates nightly, remove the changes that you made and see if the problem is still there. If it is you may report it here and/or also here: http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=29744

I just performed a CVS style install, and it still has the issuse. By changing line 298 in gallery2/modules/core/classes/GalleryTranslator.class to read as follows, it fixes the problem.

foreach (array('ISO-8859-1', 'ISO-8859-2', 'ISO-8859-5', 'ISO-8859-7', 'ISO-8859-9',

Could someone PLEASE check this into CVS? Thank you!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-05-30 08:48

we shouldn't changeforeach (array('ISO8859-1', 'ISO8859-2', 'ISO8859-5', 'ISO8859-7', 'ISO8859-9',to
foreach (array('ISO-8859-1', 'ISO-8859-2', 'ISO-8859-5', 'ISO-8859-7', 'ISO-8859-9',, we should simply add both cases, with and without the hyphen.
Google shows that for some distributions the format without hyphen is used (freebsd, ...) and for a lot others the format with hyphen is used.

so the complete section should look like:

	/*
	 * Try appending some character set names; some systems (like FreeBSD) need this.
	 * Some require a format without hyphen and others with a format with hyphen.
	 */
	foreach (array('ISO8859-1', 'ISO8859-2', 'ISO8859-5', 'ISO8859-7', 'ISO8859-9',
		       'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-5', 'ISO-8859-7', 'ISO-8859-9',
		       'EUC', 'Big5') as $charset) {
 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2005-05-30 16:15

fine with me, if you add to the comment an example OS that uses the hyphen.. Ellipse didn't seem to mention what OS..

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-05-30 17:04

in cvs now.
get tomorrows nightly snapshot if you need this fix.

 
Ellipse

Joined: 2005-05-30
Posts: 2
Posted: Mon, 2005-05-30 18:12

Sorry about that. I believe it is on a FreeBSD system.

Unfortunately, when I make that change, it breaks again.

Since I am not a PHP programmer, just an HTML hacker (in the classic sense, not the modern media definition), I am not sure how this can be corrected for everyone.

However, is there a way to check what operating system it is running on, or have a better error handling process?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-05-30 18:26

did you take the change i posted here in the forums and applied it? or did you already update your version from cvs / nightly snapshot? because cvs / nightly snapshot are still using the old code.

google searching says it's ISO8859-* for freebsd, not ISO-8859-*, so it's not necessarily determined by the os.