Tommy 碎碎念

Tommy Wu's blog

« 上一篇 | 下一篇 »

修正 Gallery2 在使用 Gallery Remote 時, 無法正確儲存中文的問題
post by tommy @ 21 三月, 2006 18:19
Gallery2 中使用 Gallery Remote 時, 建立新相簿時, 所輸入的中文, 在 Gallery 中都沒有辦法正常的顯示出來.

執行 Gallery Remote 的除錯版本, 可以發現在傳送字串時, 會把中文轉成 UTF-8, 但是是轉成 〹 之類的碼. 但是 Gallery2 在收到時, 會把 & 再轉成 &, 所以就變成了 〹. 這樣子在網頁上看到的就變成 〹 而不是一個中文字了.

下面這個 patch, 可以修正這個問題:

--- 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();

可以由這兒抓取: http://www.teatime.com.tw/~tommy/mypatch/gallery_remote_and.patch 

這個是對 Gallery 2.1RC2a 所做的 patch, 如果你的版本不一樣, 就找看看 module/remote/GalleryRemote.inc 這個檔案的 handleRequest 這個 function. 在裡頭加上 GalleryUtilities::unsanitizeInputValues($form, false); 就可以了.

這個 patch 已經 submit 給 Gallery team: http://sourceforge.net/tracker/index.php?func=detail&aid=1455284&group_id=7130&atid=307130 

Del.icio.us Furl HEMiDEMi Technorati MyShare
commons icon [1] Re:修正 Gallery2 在使用 Gallery Remote 時, 無法正確儲存中文的問題 [ 回覆 ]

您好
您上面的連結的 patch 檔案是針對 Gallery 2.1 RC2a
那我目前使用的是 Gallery 2.2 就不適用了是嗎?

那我是否就照您所說在 modulr/remote/GalleryRemote.inc 裡面加上 GalleryUtilities::unsanitizeInputValues($form, false); 就可以了

還要再請問一個可能您會覺得很笨的問題
您提供的 patch 要如何使用?

謝謝!

commons icon [2] Re:修正 Gallery2 在使用 Gallery Remote 時, 無法正確儲存中文的問題 [ 回覆 ]

沒錯, 加上那一行就可以了.
這個修正沒被作者接受... 所以到 2.2 仍可以使用.

迴響
暱稱:
標題:
個人網頁:
電子郵件:
authimage

迴響

  

Bad Behavior 已經阻擋了 61 個過去 7 天試圖闖關的垃圾迴響與引用。
Power by LifeType. Template design by JamesHuang. Valid XHTML and CSS