[SOLVED] problem with accents in french
|
cat1910
Joined: 2005-05-23
Posts: 5 |
Posted: Mon, 2005-05-23 11:30
|
|
Hi, I've installed the last nightly snapshot of Gallery 2 Beta 3 (23/05/2005) on my website (located on an OVH server) There is a problem with the accents in the menus, not in the comments I've add in the album or the picture. For example "propriétaire" appears "Propriétaire". What can I do ? Thanks a lot for your help, and thanks for that really nice program. Catherine |
|

Posts: 8601
browse to upgrade/index.php and go up to step 2.. does it report any missing/modified files?
also please fill out the support template.
Posts: 5
Just that warning :
Gallery file integrity Warning
- Old files (2)
These files are no longer part of Gallery. They probably won't cause any problems but it is a good idea to remove them to keep your install clean.
modules/core/test/data/test3.gif
modules/core/test/data/localUploadDir/test3.gif
Gallery URL (optional): http://www.catherinevandyk.com/gallery
Gallery version: gallery 2 beta 3 0.9.18
Webserver (with version): Linux web52.300gp.ha.ovh.net 2.4.28-mutu
Datatabase (with version): MySQL 3.23.58
PHP version (eg 4.2.1): PHP Version 4.3.11
phpinfo URL (optional): http://240gp.ovh.net/test.php
Graphics Toolkit(s): exif, gd2
Operating system:
Web browser/version: IE6, Mozilla Firefox 1.0.3
Posts: 5
Posts: 9
Same issue here, with the same host (www.ovh.com)
Step 2 says:
System Checks
PHP Version Success
FILE Directive Success
Safe Mode Success
exec() allowed Success
set_time_limit() allowed Success
Memory limit (no limit) Success
File uploads allowed Success
Maximum upload size (2Mb) Success
Maximum POST size (8Mb) Success
Gallery file integrity Warning
+ Modified files (1)
It is a fresh installation.
Note that when I moved from my previous web host to OVH, I had the same problem with my database for drupal which I had to rebuild (the problem is not really the same as here, gallery2 is a fresh install).
Tom
Posts: 32509
Tdb, which file is modified?
Posts: 8601
cat1910, I don't know why the characters don't appear correctly.. perhaps try changing some components (php version, isapi instead of cgi, webserver version, or on a different OS..) and see if anything helps..
Posts: 5
:cry: I can't do anything on the webserver, php version, etc...
so I'll have to go back to Gallery 1.
Thanks for your answer !
Posts: 32509
mindless, tim_j has the same problem, just for german (deutsch) umlauts.
Posts: 9
Well, I don't know, I was expecting I could click on the "+" sign in front of " Modified files (1)" to see it, but it is not clickable, how can I see it?
Thank,
Tom
Posts: 32509
Tdb, deactivated javascript? g2 has some use of javascript, you should activate it.
Posts: 9
OK, I have now the wrong file:
layouts/classic/po/fr_FR.po
I thought it was a good sign, I have replaced the file on the server with the one from the archive, and now, step 2 shows success for file integrity:
Gallery file integrity => Success
However, the problem remains
http://www.vaniche.be/gallery2/main.php
Thanks,
Tom
Posts: 8601
Ok, here is a test.php file to try on your server:
<?php putenv('LANG=fr_FR'); putenv('LANGUAGE=fr_FR'); $locale = setlocale(LC_ALL, 'fr_FR'); bindtextdomain('modules_core', '/path/to/gallery2/modules/core/locale'); bind_textdomain_codeset('modules_core', 'UTF-8'); textdomain('modules_core'); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> </head><body> Selected locale: <?php var_dump($locale); ?> <br/> Translate 'advanced search': <?php print dgettext('modules_core', 'advanced search'); ?> </body></html>Set the correct path in the bindtextdomain line. Adjust the 'fr_FR' string in the setlocale call to the right value for your OS if you see "Selected locale: false" when you try the php file.
Posts: 9
Mindless/codeful, thanks for the outstanding work you do to help me.
I have modified the file according to your recommendations:
bindtextdomain('modules_core', '/home/vaniche/www/gallery2/modules/core/locale');
But I get the following error:
Fatal error: Call to undefined function: bind_textdomain_codeset() in /home/vaniche/www/gallery2/test.php on line 6
From the documentation, it looks like this function was added in php 4.2.0, and ovh uses 4.3.1.
Could the problem be due to this? Is it a function that needs to be enabled at compilation time? Compilation options are visible at this link:
http://60gp.ovh.net/test.php
Cheers,
Tom
Posts: 32509
Tdb, thanks for the feedback.
Related php bug reports:
http://bugs.php.net/search.php?search_for=bind_textdomain_codeset&boolean=0&limit=10&order_by=&direction=ASC&cmd=display&status=All&php_os=&phpver=&assign=&author_email=&bug_age=0
see: http://bugs.php.net/bug.php?id=29407
also see (windows):
http://bugs.php.net/bug.php?id=21525&edit=2
but G2 does not depend on bind_textdomain_codeset() for translations. But it could be a sign that other related stuff isn't ok on your system either.
Tdb, can you comment out / remove the line "bind_textdomain_codeset('modules_core', 'UTF-8'); " from mindless' test script and tell us what the result is?
Posts: 32509
mindless,
i tried the above script, and it wasn't translated. i have fr_FR installed (locale -a) on my system. And yes, I used the correct path to core/locale
this was the output:
In G2, it works nevertheless perfectly: i get "recherche avancée" in the sidebar when using French.
Posts: 9
This is the output I get when removing the problematic line:
Selected locale: string(5) "fr_FR"
Translate 'advanced search': advanced search
Thanks,
Tom
Posts: 8601
ah, silly me.. that string is localized in the search module, not core.. here's an updated script that also handles not having bind_textdomain_codeset.
<?php header('Content-Type: text/html; charset=UTF-8'); putenv('LANG=fr_FR'); putenv('LANGUAGE=fr_FR'); $locale = setlocale(LC_ALL, 'fr_FR'); bindtextdomain('modules_search', '/path/to/gallery2/modules/search/locale'); $x = function_exists('bind_textdomain_codeset'); if ($x) bind_textdomain_codeset('modules_search', 'UTF-8'); textdomain('modules_search'); $y = dgettext('modules_search', 'advanced search'); if (!$x) { require_once('/path/to/gallery2/bootstrap.inc'); require_once('/path/to/gallery2/modules/core/classes/GalleryCoreApi.class'); $z = GalleryCoreApi::convertToUtf8($y); } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-s trict.dtd"> <html><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> </head><body> Selected locale: <?php var_dump($locale); ?> <br/> Translate 'advanced search': <?php print $y; ?> <br/> <?php if (!$x) print "Convert to UTF-8: $z"; ?> </body></html>Note 2 places now to update the path.
edit by valiant: added require_once for bootstrap.inc, now it works for the other cases too.
Posts: 32509
mindless, ah, that's the problem!!
Now, i pretend to not have bind_textdomain_codeset (just set $x = false):
and this is the rather familiar output:
Posts: 32509
mindless, and when I don't use bind_textdomain_codeset and comment out the replacement, i get the correct output!
so, is the conclusion that ::convertToUtf8() is not needed?
output in this scenario:
Selected locale: string(5) "fr_FR" Have bind_textdomain_codeset: no Translate 'advanced search': recherche avancée this was obtained with setting $x = false after the function_exists check and with commenting out /* if (!$x) { require_once('/var/www/localhost/htdocs/gallery2/bootstrap.inc'); require_once('/var/www/localhost/htdocs/gallery2/modules/core/classes/GalleryCoreApi.class'); $y = GalleryCoreApi::convertToUtf8($y); } */Posts: 9
This is the error message I now get:
Fatal error: Call to a member function on a non-object in /home/vaniche/www/gallery2/modules/core/classes/helpers/GalleryCharsetHelper_simple.class on line 105
Thanks,
Tom
Posts: 32509
Tdb, i have changed the code from mindless a few minutes after he has posted it. get the code again and try again, it works for me.
Posts: 8601
ya, it seems likely we're doing an unnecessary conversion there. our *.mo files are already UTF-8 after all.. the question is, is there some environment where we do need that conversion, or do we remove it completely?
I modified the code above once more, to show the output before and after convertToUtf8.
Here is the comment in the code about that conversion:
/* * If there is no bind_textdomain_codeset (PHP 4.1.x), the string will be returned * from gettext in the default encoding for that language. Here we convert that * encoding to the active charset manually. */Posts: 32509
Don't know...
it would be safe if we could detect the encoding of the string and convert only if needed.
Hmm, a use case... what if the string we want to translate isn't in utf8 and the *gettext() function doesn't find a translation?
does it then return non-utf8 again?
Posts: 8601
hm, the input strings in G2 should always be english.. so probably that use case won't apply, right?
Posts: 32509
i have no idea if we call this translation method with english strings that are not utf8.
but if we do and *gettext finds no translation, we could end up with something that is non-utf8.
don't know if we have any english (non-utf8) strings that contain non-utf8 safe characters though
Posts: 9
It looks like it is not really necessary that I give the result anymore, but here it is:
Selected locale: string(5) "fr_FR"
Translate 'advanced search': recherche avancée
Convert to UTF-8: recherche avancée
Thanks,
Tom
Posts: 8601
thanks Tdb.. what is your OS/php version?
valiant, I don't think we'll have non-utf8 chars in the input strings.
so, I ran the locale.php test on php 4.1 and found that the convertToUtf8 is required there, as the comment above implies.. now we need to determine under what conditions we skip that conversion..
Posts: 9
Mindless, it looks like OS/php version used by my web host is Linux 2.4.26 / PHP 4.3.11 :
http://60gp.ovh.net/test.php
Thanks,
Tom
Posts: 8601
Ok, fix committed to cvs.. we're really just guessing that php 4.2+ doesn't need convertToUtf8 of gettext results even if bind_textdomain_charset is missing.. hopefully that works for everyone.
Posts: 9
Yipee
Great job, thanks!
Tom
Posts: 5
Thanks a lot, that works great !
Posts: 14
i was about to up that topic because i have same encoding problems, but it looks like my version of php is just very old (4.1.2).
I can't update it on my production environnement so i'll wait for a major upgrade.
I post about it anyway if it can be usefull or investigated.
TIA
Xavier
Posts: 2
Ok, I just downloaded the FINAL version, today is the 27thof April 2006, ONE YEAR LATER ! And I have EXACTLY the same problems with the French language !
What do I need to do, install a BETA ?
Please help me !!
Posts: 8601
FAQ: What information is required when I ask for help in the forums?
Probably start a new topic.
Don't know what all the CAPS is about.. there's something wrong with your environment, did you expect us to fix your environment in the past year?
Posts: 14
i do think it's about your environnement too, i can't upgrade to a newer version of php yet so i deal with it as it is. It's no big deal, i switched to english only.