[問題] 發文時的笑臉創造器中文亂碼

phpBB Plus Support
本區是討論關於 phpBB 2 plus 使用上的問題討論!
(發表文章請按照公告格式發表,違者砍文)

版主: 版主管理群

主題已鎖定
bibo8045
星球公民
星球公民
文章: 83
註冊時間: 2005-03-06 18:34

[問題] 發文時的笑臉創造器中文亂碼

文章 bibo8045 »

PLUS 1.53
爬文搜尋笑臉創造器無解決方法....記得以前有的說!
不知道哪位大大知道解決方法的?
bibo8045
星球公民
星球公民
文章: 83
註冊時間: 2005-03-06 18:34

文章 bibo8045 »

補上出錯誤的圖片一張..

圖檔
wu2017
竹貓忠實會員
竹貓忠實會員
文章: 359
註冊時間: 2002-08-20 15:23
來自: 平凡心動
聯繫:

文章 wu2017 »

使用全新 PLUS 1.53 UTF-8 測試,多國語言的文字都成為亂碼。
無解中 -.-

[預覽] 若有相關文字成為亂碼,請將 AJAX 功能關閉即可。
我們都想寫下自己的故事,才初執筆就驚覺,悲歡離合竟也是年輕事!
平凡心動 http://www.hope99.idv.tw/

提出問題時,請提供較完整的資料,才能給你正確的答案,節省你的時間。
發問格式可參閱: http://phpbb-tw.net/phpbb/viewtopic.php?t=15329

PLUS 下載位址: http://www.phpbb2.de/dload.php?action=c ... &cat_id=20
~倉木麻衣~
竹貓忠實會員
竹貓忠實會員
文章: 1405
註冊時間: 2004-03-21 21:00

文章 ~倉木麻衣~ »

那個問題跟狀態簽名檔的中文問題是相同的, 主要是字型的問題
請先找一個有支援utf8的字型檔, 例如Widnows的mingliu.ttc
將字型上傳到plus的根目錄下, 然後這樣子修改
#
#----------[ OPEN ]--------------------
#
text2schild.php

#
#----------[ FIND ]--------------------
#

代碼: 選擇全部

$schriftdatei = 'arial';
#
#----------[ REPLACE WITH ]--------------------
#
# 請視實際上傳的檔案名稱做修改

代碼: 選擇全部

$schriftdatei = 'mingliu.ttc';
#
#----------[ SAVE/CLOSE FILE ]--------------------
#
# EoM

如果你論壇採用的編碼是big5的話, 請先確認主機有支援iconv
確認支援iconv之後, 請再多做底下的修改
#
#----------[ OPEN ]--------------------
#
text2schild.php

#
#----------[ FIND ]--------------------
#

代碼: 選擇全部

if(!$text) $text = 'error';//$lang['SC_error'];
#
#----------[ AFTER, ADD ]--------------------
#
代碼:

代碼: 選擇全部

$text = iconv('Big5', 'UTF-8', $text);
#
#----------[ SAVE/CLOSE FILE ]--------------------
#
# EoM

另外提供一個檔案大小比mingliu.ttc還小的utf8字型
請按此下載
謝絕所有私人訊息詢問外掛相關問題
有問題請直接於版上發表, 集思廣議絕對比專挑特定人士詢問來的好

竹貓禁止發表含破解相關的軟體, 違者砍文
不要跟我講別的地方都可以發, 為什麼竹貓就不行
免費不等於破解, 傻傻的搞不清楚
bibo8045
星球公民
星球公民
文章: 83
註冊時間: 2005-03-06 18:34

文章 bibo8045 »

麻衣大
您的藥方果然藥到病除...笑臉器中文的亂碼問題解決了!
現下出現一個小問題,就是笑臉的小矮人拿的那個牌子阿,出現的字有一點突出上方了,沒有全部都在方格內...我試過幾個字型檔,都會有這個問題,最好的狀況是一開始您所舉例的那個mingliu.ttc檔..也是會凸到看板上頭一點,只是情況會比較好些而已!

wu2017大大說的關閉Ajax讓預覽不會發生亂碼也是一針見血!

相當感激兩位的幫助與分享。
kenspc
星球公民
星球公民
文章: 69
註冊時間: 2006-11-12 20:31
聯繫:

文章 kenspc »

我也是有同樣的問題, 我用手動修改把字往上移2pixel
但還是遇見句子太長的話會被吃字(無解中...) XD

以下是我修改的內碼, 希望對你有幫助
如果你使用mingliu.ttc
#
#----------[ OPEN ]--------------------
#
text2schild.php

#
#----------[ FIND ]--------------------
#

代碼: 選擇全部

$i = 0;
while($i < count($output)){
	if(((!$gd_info['FreeType Support']) || (!file_exists($schriftdatei)))){
		if($schattenfarbe) imagestring($img, 2, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2 + 1), ($i * $schriftheight + 6), trim($output[$i]), $txt2color);
		imagestring($img, 2, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2), ($i * $schriftheight + 5), trim($output[$i]), $txtcolor);
	}else{
		if($schattenfarbe) imagettftext($img, $schriftheight, 0, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2 + 1), ($i * $schriftheight + $schriftheight + 4), $txt2color, $schriftdatei, trim($output[$i]));
		imagettftext($img, $schriftheight, 0, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2), ($i * $schriftheight + $schriftheight + 3), $txtcolor, $schriftdatei, trim($output[$i]));
	}
	$i++;
}
#
#----------[ REPLACE WITH ]--------------------
#

代碼: 選擇全部

$i = 0;
while($i < count($output)){
	if(((!$gd_info['FreeType Support']) || (!file_exists($schriftdatei)))){
		if($schattenfarbe) imagestring($img, 2, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2 + 1), ($i * $schriftheight + 6) + 2, trim($output[$i]), $txt2color);
		imagestring($img, 2, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2), ($i * $schriftheight + 5) + 2, trim($output[$i]), $txtcolor);
	}else{
		if($schattenfarbe) imagettftext($img, $schriftheight, 0, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2 + 1), ($i * $schriftheight + $schriftheight + 4) + 2, $txt2color, $schriftdatei, trim($output[$i]));
		imagettftext($img, $schriftheight, 0, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2), ($i * $schriftheight + $schriftheight + 3) + 2, $txtcolor, $schriftdatei, trim($output[$i]));
	}
	$i++;
}
#
#----------[ SAVE/CLOSE FILE ]--------------------
#
# EoM
bibo8045
星球公民
星球公民
文章: 83
註冊時間: 2005-03-06 18:34

文章 bibo8045 »

的確~
中文字數一多就不能用了..
似乎水土還是有點不符~

像AJAX快速回文的功能..第一次成功~再按一次編輯時內文也是會掛!
kenspc
星球公民
星球公民
文章: 69
註冊時間: 2006-11-12 20:31
聯繫:

文章 kenspc »

關於笑臉創造器吃字的問題, 排位問題和多行處理問題我都決解了
不過, 一定要有php 4.3以上和gd 要support free type font

#
#----------[ OPEN ]--------------------
#

text2schild.php

#
#----------[ FIND ]--------------------
#

代碼: 選擇全部

$schriftdatei = 'arial';
#
#----------[ REPLACE WITH ]--------------------
#
# mingliu.ttc是目前我試到最好的字型, 如果用其它字型可能要做一點調試

代碼: 選擇全部

$schriftdatei = 'mingliu.ttc';

#
#----------[ FIND ]--------------------
#

代碼: 選擇全部

	$worte = split(" ", $text);

	if(is_array($worte)){
		$i = 0;
		foreach($worte as $wort){
			if((strlen($output[$i].' '.$wort) < 33) && (!substr_count($wort, '[SM'))){
				$output[$i] .= ' '.$wort;
			}else{
				if($i <= 11){
					if($zeichenzahl < strlen($output[$i])) $zeichenzahl = strlen($output[$i]);
					$i++;
					$output[$i] = $wort;
				}
			}
		}
	}else{
		$zeichenzahl = 33;
		$output[0] = substr($text, 0, 30)."...";
	}
#
#----------[ REPLACE WITH ]--------------------
#
# 處理句字多長要断行的問題

代碼: 選擇全部

	// BEGIN -- kenspc modified
	$worte = split(" ", $text);
    $output[0] = '';
	if(is_array($worte)){
		$i = 0;
		foreach($worte as $wort){
			if((strlen($output[$i].' '.$wort) < 33) && (!substr_count($wort, '[SM'))){
				$output[$i] .= ' '.$wort;
			}else{
				if($i <= 11){
					if($zeichenzahl < strlen($output[$i])) $zeichenzahl = strlen($output[$i]);
					if($output[$i] == ''){
						$output[$i] = $wort;
					}else{
						$i++;
						$output[$i] = $wort;
					}
				}
			}
		}
	}else{
		$zeichenzahl = 33;
		$output[0] = substr($text, 0, 30)."...";
	}
	// END -- kenspc modified
#
#----------[ FIND ]--------------------
#

代碼: 選擇全部

$width = ($zeichenzahl * $schriftwidth) + 6;
$height = (count($output) * $schriftheight) + 34;
#
#----------[ REPLACE WITH ]--------------------
#
# 利用imagettfbbox來計算句字的寛和高

代碼: 選擇全部

// BEGIN -- kenspc modified
//$width = ($zeichenzahl * $schriftwidth) + 6;
//$height = (count($output) * $schriftheight) + 34;
if(((!$gd_info['FreeType Support']) || (!file_exists($schriftdatei)))){
	$width = ($zeichenzahl * $schriftwidth) + 6;
	$height = (count($output) * $schriftheight) + 34;
}else{
	$ttfbboxwidth = 0;
	$i = 0;
	while($i < count($output)){
		$ttfbbox = imagettfbbox($schriftheight, 0, $schriftdatei, trim($output[$i]));
		$tempwidth = $ttfbbox[4] - $ttfbbox[6];
		if($ttfbboxwidth <= $tempwidth){
		  $ttfbboxwidth = $tempwidth;
		}
		$i++;
	}
	$width = $ttfbboxwidth + 6;
	
	$ttfbboxheight = abs($ttfbbox[5] - $ttfbbox[3]);
	$height = (count($output) * $ttfbboxheight) + 34;
}
// END -- kenspc modified
#
#----------[ FIND ]--------------------
#

代碼: 選擇全部

$i = 0;
while($i < count($output)){
	if(((!$gd_info['FreeType Support']) || (!file_exists($schriftdatei)))){
		if($schattenfarbe) imagestring($img, 2, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2 + 1), ($i * $schriftheight + 6), trim($output[$i]), $txt2color);
		imagestring($img, 2, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2), ($i * $schriftheight + 5), trim($output[$i]), $txtcolor);
	}else{
		if($schattenfarbe) imagettftext($img, $schriftheight, 0, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2 + 1), ($i * $schriftheight + $schriftheight + 4), $txt2color, $schriftdatei, trim($output[$i]));
		imagettftext($img, $schriftheight, 0, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2), ($i * $schriftheight + $schriftheight + 3), $txtcolor, $schriftdatei, trim($output[$i]));
	}
	$i++;
}
#
#----------[ REPLACE WITH ]--------------------
#
# 把句字貼上去!!

代碼: 選擇全部

// BEGIN -- kenspc modified
$i = 0;
while($i < count($output)){
	if(((!$gd_info['FreeType Support']) || (!file_exists($schriftdatei)))){
		if($schattenfarbe) imagestring($img, 2, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2 + 1), ($i * $schriftheight + 6) + 2, trim($output[$i]), $txt2color);
		imagestring($img, 2, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2), ($i * $schriftheight + 5) + 2, trim($output[$i]), $txtcolor);
	}else{
		if($schattenfarbe) imagettftext($img, $schriftheight, 0, (($width - $ttfbboxwidth - 2) / 2 + 1), ($i * $ttfbboxheight + $schriftheight + 4) + 4, $txt2color, $schriftdatei, trim($output[$i]));
		imagettftext($img, $schriftheight, 0, (($width - $ttfbboxwidth - 2) / 2), ($i * $ttfbboxheight + $schriftheight + 3) + 4, $txtcolor, $schriftdatei, trim($output[$i]));
	}
	$i++;
}
// END -- kenspc modified
#
#----------[ SAVE/CLOSE FILE ]--------------------
#
# EoM

如果有什麼錯請指教^^
主題已鎖定

回到「phpBB 2 plus 綜合討論」