網域名稱俱樂部

網域名稱俱樂部 (https://www.domainclub.org/index.php)
-   一般軟體與網路使用討論 (https://www.domainclub.org/forumdisplay.php?f=43)
-   -   請教亂碼的問題 (https://www.domainclub.org/showthread.php?t=16836)

哈啦 2007-06-23 12:22 AM

請教亂碼的問題
 
我有一個文件,很奇怪,那個文件執行時,所有填上中文的都可以順利顯示,唯獨裡面一塊「內容簡介」裡填上中文,出來時卻成為亂碼?整個網站都已採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"}

琉璃仙人 2007-06-23 01:01 AM

另存为utf-8 无bom就可以了~

哈啦 2007-06-23 01:10 AM

引用:

作者: 琉璃仙人 (文章 102996)
另存为utf-8 无bom就可以了~


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

琉璃仙人 2007-06-23 09:47 AM

一般我们使用UltraEdit-32 对于文件编译完,选择另存为,如果是utf-8格式,含有中文,里面有一个utf8无bom格式。
这是因为我们一般中文会在函数里面产生多余bom影响显示

琉璃仙人 2007-06-23 09:49 AM

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"} 


琉璃仙人 2007-06-23 09:52 AM

http://img405.imageshack.us/img405/9396/56581441jt3.jpg

哈啦 2007-06-23 11:36 AM

引用:

作者: 琉璃仙人 (文章 103016)


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

琉璃仙人 2007-06-23 12:57 PM

引用:

作者: 哈啦 (文章 103019)
這是哪一版的ultraedit?我目前用的ultraedit32 11.00a+版找不到這個選項,能把這個選項所在的工具列位置弄個screenshot給我看嗎?thanks

http://img108.imageshack.us/img108/1134/30592356rn7.jpg

哈啦 2007-06-23 02:33 PM

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

http://img513.imageshack.us/img513/2246/21157450ec5.gif

caicaimaopk 2007-06-23 06:43 PM

1 乱码的页面 右键看源代码 看看charset是不是utf-8
2 tpl本身是否是utf-8
或者干脆把这个tpl就改成四个汉字 內容簡介 看它還是不是亂的


所有時間均為 +8。現在的時間是 01:05 PM

Powered by vBulletin® 版本 3.8.4
版權所有 ©2000 - 2024,Jelsoft Enterprises Ltd.