Wrong result when create an Album, the Title/Name/Description with Chinese string

twu2

Joined: 2005-10-12
Posts: 7
Posted: Sun, 2006-09-17 13:46

Hi!

Every time, if I create a new album from Gallery Remote, and use Chinese in Album Title or Album Name or Album Description, it will get a wrong result in Gallery.

For example:

1. Create a new album with Chinese title/name/description from Gallery Remote, like this:
[img]http://www.teatime.com.tw/~tommy/GR_bugs/gr_chinese_1.jpg[/img]

2. If logout from Gallery Remote and login again, will get the album like (Chinese word will become '&#nnnn;'):
[img]http://www.teatime.com.tw/~tommy/GR_bugs/gr_chinese_3.jpg[/img]

3. View this new album from browser, it will like (Chinese word will become '&#nnnn;'):
[img]http://www.teatime.com.tw/~tommy/GR_bugs/gr_chinese_2.jpg[/img]
[img]http://www.teatime.com.tw/~tommy/GR_bugs/gr_chinese_4.jpg[/img]

The Chinese Word will convert to UTF-8, and encode it like '&#nnnnn;', then convert it to '&#nnnnn;', then send it to Gallery.

But in Gallery's remote module, it will convert '&' to '&' again, so '&#nnnnn;' will convert to '&#nnnnn;'.

So we get the result above.

I've submitted a patch for this problem before Gallery 2.1 release, but the problem still exist there.

--- GalleryRemote.inc.orig      2006-03-21 17:27:06.717001028 +0800
+++ GalleryRemote.inc   2006-03-21 18:16:00.940218189 +0800
@@ -73,6 +73,7 @@
     function handleRequest($form) {
        global $gallery;

+       GalleryUtilities::unsanitizeInputValues($form, false);
        $start = array_sum(explode(' ', microtime()));

        $status = $error = array();

After apply this patch in Gallery's remote module, I can get a correct result like:
[img]http://www.teatime.com.tw/~tommy/GR_bugs/gr_chinese_5.jpg[/img]
[img]http://www.teatime.com.tw/~tommy/GR_bugs/gr_chinese_6.jpg[/img]