Some chinese characters cann't display in "Summary&quot

kennylam

Joined: 2005-01-16
Posts: 3
Posted: Thu, 2005-02-10 18:57

The problem is found in the "Summary" of album only.Yet there is no problem before I updated to lastest Nightly snapshot.I did ensure that the gallery page is displayed in UTF-8 so that is certainly not encoding problem.An example is below as request.

Thanks you


Gallery URL (optional): http://kennylam.no-ip.com
Gallery version: G2,Nigtly Build released at 10 Feb
Webserver (with version): Apache 2.0.50
Datatabase (with version): MySQL 4.0.23
PHP version (eg 4.2.1): PHP 5.0.3
Graphics Toolkit(s): NetPBM/Gd/ImageMagick
Operating system: Windows Server 2003
Web browser/version: Firefox 1.0/IE6

 
virshu
virshu's picture

Joined: 2003-09-13
Posts: 314
Posted: Thu, 2005-02-10 19:21

kennylam, What is the value in the database SELECT g_summary FROM g2_Item WHERE g_title = '1_23_Rally'
or similar. I know that Bharat made changes earlier this week to use UTF in the database if it supports UTF - but I was playing with database settings after that and got ??? instead of text as well.

The best way to test - change the summary once more to have the text you want and see if it keeps Chinese characters. It looks like other albums have chinese characters in the summary, so it's something specific to this album - not to Summary field in general

 
kennylam

Joined: 2005-01-16
Posts: 3
Posted: Sat, 2005-02-12 06:46

OK,the value of g_summary is "1.23 ??"
and I tested to save a string of chinese characters in summery field,there are some ??? still.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Mon, 2005-02-14 09:51

That's odd. If you take the same characters that appear as ??? in the summary and put them into the description instead, do they still show up as ??? there also?

 
virshu
virshu's picture

Joined: 2003-09-13
Posts: 314
Posted: Tue, 2005-02-15 22:26

While I ddidn't get to the bottom of the problem, I hink I got ??? when I was playing with the collation settings of the columns themselves. If your collation is Chinese, try to put it back to swedish. I think that may fix it.

 
aihugongwu

Joined: 2003-06-05
Posts: 22
Posted: Fri, 2005-02-25 15:42

i have the same problem.
Bharat, the same char shows fine in description. appear as ??? in summary, title, side-bar, header.

 
aihugongwu

Joined: 2003-06-05
Posts: 22
Posted: Tue, 2005-03-01 05:35

anyone?
help please~~
sorry i donot understand what is "change collation to swedish".

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2005-03-03 04:31

Please start by upgrading to the latest nightly snapshot and see if you can reproduce this problem. If you can, then I'll have to investigate this problem more closely. Would it be possible to get ssh access to a machine that's exhibiting this behavior?

 
aihugongwu

Joined: 2003-06-05
Posts: 22
Posted: Fri, 2005-03-04 03:21

i do cvs upgrade everyday but the problem never say goodbye to me.

Gallery URL (optional): http://dai.blogdns.com/sejishikong/
Gallery version: G2,Nigtly Build March.3
Webserver (with version): Apache 2.0.50
Datatabase (with version): MySQL 4.1
PHP version (eg 4.2.1): PHP 4.3.4
Graphics Toolkit(s): NetPBM/Gd/ImageMagick
Operating system: Windows XP pro JP
Web browser/version: Maxthon 1.1/IE6

i will think about to setup ssh for cygwin on the server this week end. is phpmy admin also helpful?

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Sat, 2005-03-05 19:18

How did you enter the data into G2? Was it through the web form or did you migrate from G1?

 
aihugongwu

Joined: 2003-06-05
Posts: 22
Posted: Sun, 2005-03-06 15:59

both, migrate from g1 and add items from web. it was fine. but after i did cvs update someday about 3 weeks ago, some chinese and japanese word begin to displayed as ???. i tested to add new album with chinese summary from web, but it displayed as ??? too.
i understand that encoding of the table was changed to utf8. but the data looks fine in the db table.

except that colum "g_subject" in "g2_comment" is really strange with some data like"ԲԲµİְÖ" after the g1 migration.

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Sun, 2005-03-06 18:22

Do you know if you have iconv, recode, or mb_string functions compiled in to your php?

 
choipo

Joined: 2005-01-18
Posts: 18
Posted: Mon, 2005-03-07 01:58

I am using Fedora 3
Apache/2.0.52
PHP 4.3.9
mysql Ver 11.18 Distrib 3.23.58

All packages are come with Fedora3 and all are new installation
And the gallery2 is also a new installation which is not migrated from v1.

Also, i found that most field have character problem but description field is ok.

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Mon, 2005-03-07 03:09

Do you know if you have iconv, recode, or mb_string functions compiled in to your php?

 
choipo

Joined: 2005-01-18
Posts: 18
Posted: Mon, 2005-03-07 03:31

sorry about that, how to check it?

 
aihugongwu

Joined: 2003-06-05
Posts: 22
Posted: Mon, 2005-03-07 04:15
jmullan wrote:
Do you know if you have iconv, recode, or mb_string functions compiled in to your php?

i only have iconv, below is from phpinfo:

iconv
iconv support enabled
iconv implementation libiconv
iconv library version 1.7

Directive Local Value Master Value
iconv.input_encoding ISO-8859-1 ISO-8859-1
iconv.internal_encoding ISO-8859-1 ISO-8859-1
iconv.output_encoding ISO-8859-1 ISO-8859-1

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Mon, 2005-03-07 04:16

Look for iconv, recode, and/or mb_string in your phpinfo output.

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Mon, 2005-03-07 04:58

oops, I didn't see your response on this next page when I responded.

 
fatman_li

Joined: 2004-02-06
Posts: 7
Posted: Mon, 2005-03-07 16:03

I have just upgraded to 2005-03-07 build.
What I found is if the unicode of Chinese in summary, title, keyword

before x7FFF "翿" is OK
after x8000 "耀" become ??

however, it seem no problem if they are input in the description

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Tue, 2005-03-08 08:49

Oh ho! Now that is a terrific example of the problem. This is a boundary bug in GalleryUtilities::unicodeValueToUtf8Value(). I've fixed it and added a new unit test so it won't regress. Try the next nightly build and let me know if that resolves the problem!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-03-08 08:56

Does that make fatman_li the user of the week? :-D

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Tue, 2005-03-08 09:18

Yes it does! Congratulations fatman_li! You are the user of the week! You get a free week's worth of nightly builds :-)

 
Dust_Puppy

Joined: 2005-03-08
Posts: 6
Posted: Tue, 2005-03-08 11:57

I have problems with swedish characters when i try to migrate from gallery 1 or edit a field the characters å ä ö becoms 㡤 öis Could this be caused by the same bug ?

i did not have this problem in gallery 1.* or gallery 2 apha

/Dust

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-03-08 12:08

Dust_Puppy,

Quote:
Try the next nightly build and let me know if that resolves the problem!

hm, i'm in another timezone than bharat, but i guess his last change should have made it into the current nightly.
get: http://galleryupdates.jpmullan.com/
G2/current.gallery2.tar.gz
and try if it solves your problem with swedish chars. thanks!

 
Dust_Puppy

Joined: 2005-03-08
Posts: 6
Posted: Tue, 2005-03-08 13:40

same problem with todays build.. i have not installed "gettext" could that have something to do with it ?

EDIT:
i found out that the problem dont accure in the comment body only in the subject. and when if i enter the same text in the subject as in the body they look diffrent in the DB, so it defently looks like the same problem..

 
fatman_li

Joined: 2004-02-06
Posts: 7
Posted: Tue, 2005-03-08 17:21

I updated the GalleryUtilities.class from CVS, the update problem on title is fixed.

But if I retrieve the old data from DB(I believe in old version of gallery, the chinese was stored as HTML decimal notation in DB), seem that it also unable to interpret them correctly if the unicode is out of boundary.

Of course, I can fixed it by enter the item title again.

I will try my best to download this week builds! :D

 
Dust_Puppy

Joined: 2005-03-08
Posts: 6
Posted: Wed, 2005-03-09 10:53

i still have the same problem
take a look att http://www.thornstrom.se/gallery2/main.php?g2_view=core:ShowItem&g2_itemId=435&g2_navId=x4ce453c2

this album has a title, description and summary with the frase "ölan är åker"
it shows fine in the description but not in any of the other fields..

this is todays build i extracted it over the old one, run the update procedure and created this test album.

any clue what could be wrong ?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Fri, 2005-03-11 04:42

Dust_Puppy, that link doesn't work for me.. looks like you deleted the album or I don't have permissions to see it. Can you create a test account with permissions to add or edit albums so that we can experiment from here and see if we can figure out what's going wrong? Thanks.

 
Dust_Puppy

Joined: 2005-03-08
Posts: 6
Posted: Fri, 2005-03-11 08:46

Absolutly!

this is my setup
Gallery URL (optional): http://www.thornstrom.se/gallery2/
Gallery version: G2,Nigtly Build released at 09 mars
Webserver (with version): Apache 2.0.52
Datatabase (with version): MySQL 4.1.9
PHP version (eg 4.2.1): PHP 5.0.3
Operating system: Windows XP sp2

i have sent a pm with the login info bharat, thanks for looking into this.

/Dust

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2005-03-12 01:47

I tried the u/p you sent me in the private message but they didn't work :-( It says the login is incorrect so either the user is missing or the password is wrong. Can you verify them and try again?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2005-03-12 22:52

Dust_Puppy,

Hrm. Ok, I managed to log in and leave a comment. I noticed that the body of the comment comes out ok but the subject gets mangled. That's a little odd. When editing an album I noticed that the title, summary and keywords are hosed but the description isn't.

From this, I'm guessing that your database is unhappy about storing UTF8 into varchar columns. I'm not sure what's up with this; I think that I'll need to investigate it more closely. Would it be possible for me to ssh to your box and examine it more closely? I think I'll have to experiment with your settings to see what's up. It's possible that this is a new limitation/restriction in MySQL 4.1 that we'll have to address.

 
Dust_Puppy

Joined: 2005-03-08
Posts: 6
Posted: Mon, 2005-03-14 09:18

It is a windows installation =/ and i dont know if i could give you that access unfortunatly, is there anything else i can do ?, i am thinking about testing another DB tonight and then we will know if thats the problem..

/Dust

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Mon, 2005-03-14 10:57

Ah ha! I reproduced it on my Windows box. It was failing there because I didn't have gettext installed, which resulted in a bug where we were not setting the character set to UTF-8. This caused all of your data to get displayed in the wrong character set.

Update to the latest code (either from CVS, or the 3/15/2005 snapshot) and it should force your character set to UTF8. Then try editing your text and see if that fixes the problem for you.

 
aihugongwu

Joined: 2003-06-05
Posts: 22
Posted: Tue, 2005-03-15 00:41

Thanks! bharat, and fatman_li.
the problem on title was fixed from the snapshot i updated last weekend.
only 2 little bug still alive.
1. the comment_subject do not show correctly (itis little different with the above problem, it donot show as ???)
2. when you import caption with line break from G1, something will be lost, and some char do not show correctly (maybe this is just a specific?)

for example, G2:
http://dai.blogdns.com/sejishikong/main.php?g2_view=core:ShowItem&g2_itemId=1720

the original G1:
http://dai.blogdns.com/gallery/album23/P5050482

Gallery URL (optional): http://dai.blogdns.com/sejishikong/
Gallery version: G2,Nigtly Build March.3
Webserver (with version): Apache 2.0.50
Datatabase (with version): MySQL 4.1
PHP version (eg 4.2.1): PHP 4.3.4
Graphics Toolkit(s): NetPBM/Gd/ImageMagick
Operating system: Windows XP pro JP
Web browser/version: Maxthon 1.1/IE6

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Tue, 2005-03-15 02:12

Hmm .. that's odd. What happens if you add a new comment with those characters in it? Does that appear normally? Ie, if you put "

 
aihugongwu

Joined: 2003-06-05
Posts: 22
Posted: Tue, 2005-03-15 04:05

show up correctly.
yes, itis only a import problem.

ps:

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Tue, 2005-03-15 04:21

Ah, ok. So would you please re-import that album and see if the migration does it correctly this time? Please be sure to use the right character set at import time!

 
Dust_Puppy

Joined: 2005-03-08
Posts: 6
Posted: Tue, 2005-03-15 08:13

i will try to upgrade tonight :D

Thanks for the help!

/DUst

 
aihugongwu

Joined: 2003-06-05
Posts: 22
Posted: Fri, 2005-03-18 15:22

Thanks! bharat.
newly imported item is all fine.

 
willouch

Joined: 2007-09-07
Posts: 4
Posted: Mon, 2007-11-05 20:31

En patchant le fichier de gallery2, modules/core/classes/GalleryUtilities.class

function sanitizeInputValues(&$value, $adaptForMagicQuotes=true) {
...
$value = str_replace(array('&', '"', '<', '>'),
array('&amp;', '&quot;', '&lt;', '&gt;'),
$value);

$value = utf8_encode($value); //Ligne à ajouter add this line!!!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2007-11-06 13:20

@willouch

if that's necessary in your case, then something else is wrong.
it means that the data (text) that is sent to the gallery server isn't in UTF-8 yet.
maybe you've edited the theme/templates of gallery and accidentally removed an important meta charset header?
maybe you're embedding gallery in a non-utf-8 website?

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage