網域名稱俱樂部


返回   網域名稱俱樂部 > 電腦與網路技術 > 電腦網路相關技術 > 一般軟體與網路使用討論

回覆
 
主題工具
  #1  
舊 2007-06-23, 12:22 AM
哈啦 的頭像
哈啦 哈啦 目前離線
論壇管理員
 
註冊日期: 2002-05-28
文章: 22,997
預設 請教亂碼的問題

我有一個文件,很奇怪,那個文件執行時,所有填上中文的都可以順利顯示,唯獨裡面一塊「內容簡介」裡填上中文,出來時卻成為亂碼?整個網站都已採utf-8編碼,不知為何會出這種狀況?

文件如下,紅色那塊出來的內容,填上中文會成為亂碼:
引用:
{include file="header.tpl"}
{literal}
<script>
function checkform()
{
if (document.video.titletext.value == '') {
alert('Please Enter A Title');
return false;
}
else if (document.video.descriptiontext.value == '')
{
alert('Please Enter A description');
return false;
}
else if (document.video.authortext.value == '')
{
alert('Please Enter A Author');
return false;
}
else if(!document.video.picture[0].checked && !document.video.picture[1].checked && !document.video.picture[2].checked) {
alert('Please Choose A Screenshot');
return false;
}
// If the script gets this far through all of your fields
// without problems, it's ok and you can submit the form

return true;
}</script>
{/literal}
<div align="center">
<form action="submit.php?pt=submit&amp;part=3" method="post" name="video" onSubmit="return checkform()">
<!--Center Page-->
<h3><b>Source</b>:{$source}
</h3>
<!--Source Of Media-->
<b>Confirm Default Screenshot</b>
<input name="videoid" type="hidden" value="{$videoid}" />
<input name="vidtype" type="hidden" value="{$vidtype}" />
<input name="file2" type="hidden" value="{$file2}" />

<table width="136" border="0">
<!--Shows All The Images-->
<tr> {section name=default loop=$image}
<td align="center" width="130"><img src="{$image[default]}" alt="{$title}" width="130" height="97" /> </td>
{/section} </tr>
<tr> {section name=default loop=$image}
<td align="center"><input name="picture" type="radio" value="{$image[default]}" checked="checked" />
</td>
{/section} </tr>
</table>
<!-- END - Shows All The Images-->
<table width="83" border="0">
<tr>
<td height="21" align="center"><b>Title</b></td>
</tr>
<tr>
<td height="21" align="center"><textarea name="titletext" cols="50" rows="1" id="titletext" style="text-align:center; text-shadow:#990000">{$title}</textarea></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="77" height="21" align="center"><b>Author</b></td>
</tr>
<tr>
<td height="42"><textarea name="authortext" cols="50" rows="1" style="text-align:center;">{$author}</textarea> </td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="21" align="center"><b>內容簡介</b></td>
</tr>
<tr>
<td height="104"><textarea name="descriptiontext" cols="50" rows="6" style="text-align:center;">{$description}</textarea> </td>
<td>&nbsp;</td>

</tr>
<tr>
<td height="19" align="center"><b>Category</b></td>
</tr>
<tr>
<td height="104" align="center"><select name="category" size="6">


{section name=cat loop=$cat}
<option value="{$cat[cat].id}" {if $cat[cat].id eq "1"}selected="selected"{/if}>{$cat[cat].name}</option>
{/section}



</select> </td>
<td>&nbsp;</td>
</tr>
</table>
<p align="center">{include file="players.tpl"} </p>
<p align="center">
<input type="submit" value="Submit">
</p>
</form>
</div>
{include file="footer.tpl"}
__________________
咖啡走路
微博


您是網站站長嗎?歡迎到站長俱樂部 一起討論吧。
按我看版規
code.club
回覆時引用此篇文章
  #2  
舊 2007-06-23, 01:01 AM
琉璃仙人 的頭像
琉璃仙人 琉璃仙人 目前離線
進階會員
 
註冊日期: 2006-09-28
文章: 121
發送 MSN 消息給 琉璃仙人
預設

另存为utf-8 无bom就可以了~
回覆時引用此篇文章
  #3  
舊 2007-06-23, 01:10 AM
哈啦 的頭像
哈啦 哈啦 目前離線
論壇管理員
 
註冊日期: 2002-05-28
文章: 22,997
預設

引用:
作者: 琉璃仙人 查看文章
另存为utf-8 无bom就可以了~

什麼意思?之前這個文件我已用emeditor以utf8編碼存檔,因此其中的中文「內容簡介」顯示在網頁上就是中文無誤。
__________________
咖啡走路
微博


您是網站站長嗎?歡迎到站長俱樂部 一起討論吧。
按我看版規
code.club
回覆時引用此篇文章
  #4  
舊 2007-06-23, 09:47 AM
琉璃仙人 的頭像
琉璃仙人 琉璃仙人 目前離線
進階會員
 
註冊日期: 2006-09-28
文章: 121
發送 MSN 消息給 琉璃仙人
預設

一般我们使用UltraEdit-32 对于文件编译完,选择另存为,如果是utf-8格式,含有中文,里面有一个utf8无bom格式。
这是因为我们一般中文会在函数里面产生多余bom影响显示
回覆時引用此篇文章
  #5  
舊 2007-06-23, 09:49 AM
琉璃仙人 的頭像
琉璃仙人 琉璃仙人 目前離線
進階會員
 
註冊日期: 2006-09-28
文章: 121
發送 MSN 消息給 琉璃仙人
預設

PHP 代碼:
{include file="header.tpl"}
{
literal}
<
script>
function 
checkform()
{
if (
document.video.titletext.value == '') {
alert('Please Enter A Title');
return 
false;

else if (
document.video.descriptiontext.value == '')
{
alert('Please Enter A description');
return 
false;
}
else if (
document.video.authortext.value == '')
{
alert('Please Enter A Author');
return 
false;
}
else if(!
document.video.picture[0].checked && !document.video.picture[1].checked && !document.video.picture[2].checked) {
alert('Please Choose A Screenshot');
return 
false;
}
// If the script gets this far through all of your fields
// without problems, it's ok and you can submit the form

return true;
}
</script>
{/literal}
<div align="center">
<form action="submit.php?pt=submit&amp;part=3" method="post" name="video" onSubmit="return checkform()">
<!--Center Page-->
<h3><b>Source</b>:{$source}
</h3>
<!--Source Of Media-->
<b>Confirm Default Screenshot</b>
<input name="videoid" type="hidden" value="{$videoid}" />
<input name="vidtype" type="hidden" value="{$vidtype}" />
<input name="file2" type="hidden" value="{$file2}" />

<table width="136" border="0">
<!--Shows All The Images-->
<tr> {section name=default loop=$image}
<td align="center" width="130"><img src="{$image[default]}" alt="{$title}" width="130" height="97" /> </td>
{/section} </tr>
<tr> {section name=default loop=$image}
<td align="center"><input name="picture" type="radio" value="{$image[default]}" checked="checked" />
</td>
{/section} </tr>
</table>
<!-- END - Shows All The Images-->
<table width="83" border="0">
<tr>
<td height="21" align="center"><b>Title</b></td>
</tr>
<tr>
<td height="21" align="center"><textarea name="titletext" cols="50" rows="1" id="titletext" style="text-align:center; text-shadow:#990000">{$title}</textarea></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="77" height="21" align="center"><b>Author</b></td>
</tr>
<tr>
<td height="42"><textarea name="authortext" cols="50" rows="1" style="text-align:center;">{$author}</textarea> </td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="21" align="center"><b>內容簡介</b></td>
</tr>
<tr>
<td height="104"><textarea name="descriptiontext" cols="50" rows="6" style="text-align:center;">{$description}</textarea> </td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="19" align="center"><b>Category</b></td>
</tr>
<tr>
<td height="104" align="center"><select name="category" size="6">


{section name=cat loop=$cat}
<option value="{$cat[cat].id}" {if $cat[cat].id eq "1"}selected="selected"{/if}>{$cat[cat].name}</option>
{/section}



</select> </td>
<td>&nbsp;</td>
</tr>
</table>
<p align="center">{include file="players.tpl"} </p>
<p align="center">
<input type="submit" value="Submit">
</p>
</form>
</div>
{include file="footer.tpl"} 
回覆時引用此篇文章
  #6  
舊 2007-06-23, 09:52 AM
琉璃仙人 的頭像
琉璃仙人 琉璃仙人 目前離線
進階會員
 
註冊日期: 2006-09-28
文章: 121
發送 MSN 消息給 琉璃仙人
預設

回覆時引用此篇文章
  #7  
舊 2007-06-23, 11:36 AM
哈啦 的頭像
哈啦 哈啦 目前離線
論壇管理員
 
註冊日期: 2002-05-28
文章: 22,997
預設

引用:
作者: 琉璃仙人 查看文章

這是哪一版的ultraedit?我目前用的ultraedit32 11.00a+版找不到這個選項,能把這個選項所在的工具列位置弄個screenshot給我看嗎?thanks
__________________
咖啡走路
微博


您是網站站長嗎?歡迎到站長俱樂部 一起討論吧。
按我看版規
code.club
回覆時引用此篇文章
  #8  
舊 2007-06-23, 12:57 PM
琉璃仙人 的頭像
琉璃仙人 琉璃仙人 目前離線
進階會員
 
註冊日期: 2006-09-28
文章: 121
發送 MSN 消息給 琉璃仙人
預設

引用:
作者: 哈啦 查看文章
這是哪一版的ultraedit?我目前用的ultraedit32 11.00a+版找不到這個選項,能把這個選項所在的工具列位置弄個screenshot給我看嗎?thanks
回覆時引用此篇文章
  #9  
舊 2007-06-23, 02:33 PM
哈啦 的頭像
哈啦 哈啦 目前離線
論壇管理員
 
註冊日期: 2002-05-28
文章: 22,997
預設

奇怪,我的「另存為」只有以下的畫面?

__________________
咖啡走路
微博


您是網站站長嗎?歡迎到站長俱樂部 一起討論吧。
按我看版規
code.club
回覆時引用此篇文章
  #10  
舊 2007-06-23, 06:43 PM
caicaimaopk 的頭像
caicaimaopk caicaimaopk 目前離線
初級會員
 
註冊日期: 2006-04-03
文章: 20
發送 MSN 消息給 caicaimaopk
預設

1 乱码的页面 右键看源代码 看看charset是不是utf-8
2 tpl本身是否是utf-8
或者干脆把这个tpl就改成四个汉字 內容簡介 看它還是不是亂的
__________________
十年php程式編寫
八年淘寶開店咨詢
回覆時引用此篇文章
回覆

主題工具

發文規則
不可以發表新主題
不可以發表回覆
不可以上傳附件
不可以編輯自己的文章

啟用 BB 代碼
論壇啟用 表情符號
論壇啟用 [IMG] 代碼
論壇禁用 HTML 代碼



所有時間均為 +8。現在的時間是 03:30 PM


本站主機由網易虛擬主機代管
Powered by vBulletin® 版本 3.8.4
版權所有 ©2000 - 2024,Jelsoft Enterprises Ltd.