Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > ASP > ASP Forum > ใช้ UTF8 มันมองหาข้อความไม่เจอ แต่ถ้าใช้ ANSI กับเจอข้อความอ่ะ



 

ใช้ UTF8 มันมองหาข้อความไม่เจอ แต่ถ้าใช้ ANSI กับเจอข้อความอ่ะ

 



Topic : 072524



โพสกระทู้ ( 297 )
บทความ ( 0 )



สถานะออฟไลน์




ผมเซฟไฟล์เป็นแบบ UTF8 แล้ว เปิดไฟล์ขึ้นมามันกับมองไม่เห็นข้อความที่กำหนดไว้ให้อ่ะครับ
จากโค้ด 2 โค้ดนี้ ผมเซฟเป็น uTF8 แล้ว ตรง dim a ซึ่งผมกำหนดไว้ว่า เป็นข่าวประชาสัมพันธ์ แล้วไปเรียกฟังก์ชั่นขึ้นมา(newfunc.asp) ปรากฎว่ามันไม่โชว์อะไรขึ้นมาเลย พอเปลี่ยนมาเซฟเป็น ANSI แล้วปรากฎว่ามันเจออ่ะครับ มันเป็นเพราะอะไรอ่ะครับ

Code (news.asp)
<!--#include file="header.asp"-->
<!--#include file="menu.asp"-->
<!--#include file="newfunc.asp"-->

<% session.CodePage ="65001"%>

<td valign="top" class="f2">
<table border="0" ><tr><td  width="790" align="right">
<form action="newsearch.asp" method="post">
<input name="txtsearch" type="text" />
<input name="search" type="submit" value="ค้นหา" />
</form></td></tr></table>

<script type="text/javascript">
function show_review(id) {
	if(id == 1) {
		document.getElementById("review_1").style.display = '';
		document.getElementById("review_2").style.display = 'none';
		document.getElementById("review_3").style.display = 'none';
		document.getElementById("review_4").style.display = 'none';
		document.getElementById("review_5").style.display = 'none';
	} else if(id == 2) {
		document.getElementById("review_1").style.display = 'none';
		document.getElementById("review_2").style.display = '';
		document.getElementById("review_3").style.display = 'none';
		document.getElementById("review_4").style.display = 'none';
		document.getElementById("review_5").style.display = 'none';
	} else if(id == 3) {
		document.getElementById("review_1").style.display = 'none';
		document.getElementById("review_2").style.display = 'none';
		document.getElementById("review_3").style.display = '';
		document.getElementById("review_4").style.display = 'none';
		document.getElementById("review_5").style.display = 'none';
	} else if(id == 4) {
		document.getElementById("review_1").style.display = 'none';
		document.getElementById("review_2").style.display = 'none';		
		document.getElementById("review_3").style.display = 'none';
		document.getElementById("review_4").style.display = '';
		document.getElementById("review_5").style.display = 'none';
	} else if(id == 5) {
		document.getElementById("review_1").style.display = 'none';
		document.getElementById("review_2").style.display = 'none';		
		document.getElementById("review_3").style.display = 'none';
		document.getElementById("review_4").style.display = 'none';
		document.getElementById("review_5").style.display = '';
	}
}
</script>
<br />
   <table width="100%" border="0" cellspacing="0" cellpadding="0" id="review_1" align="center">
      <tr>
        <td>
        <a href="javascript:show_review(1);" title="ข่าวประชาสัมพันธ์">    <img src="images/buttomnew1.gif"  border="0" height="77" width="150"/> </a>
        <a href="javascript:show_review(2);" title="ข่าวประกาศ">    <img src="images/buttomnew5.gif" height="77" width="150"  border="0"/>    </a>
        <a href="javascript:show_review(3);" title="ข่าวกิจกรรม">    <img src="images/buttomnew2.gif" height="77" width="150" border="0"/>    </a>
        <a href="javascript:show_review(4);" title="ข่าวการศึกษาก่อนปริญญา">		<img src="images/buttomnew3.gif" height="77" width="150" border="0"/>        </a>
        <a href="javascript:show_review(5);" title="ข่าวการศึกษาหลังปริญญา">	<img src="images/buttomnew4.gif" height="77" width="150" border="0"/>	</a>
    <% 
    dim a,c
    a="ข่าวประชาสัมพันธ์"
    call b(a) 
    %>
        </td>
      </tr>
    </table>

    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="review_2" style="display:none" align="center">
      <tr>
        <td>
       <a href="javascript:show_review(1);" title="ข่าวประชาสัมพันธ์">    <img src="images/buttomnew1.gif"  border="0" height="77" width="150"/> </a>
        <a href="javascript:show_review(2);" title="ข่าวประกาศ">    <img src="images/buttomnew5.gif" height="77" width="150"  border="0"/>    </a>
        <a href="javascript:show_review(3);" title="ข่าวกิจกรรม">    <img src="images/buttomnew2.gif" height="77" width="150" border="0"/>    </a>
        <a href="javascript:show_review(4);" title="ข่าวการศึกษาก่อนปริญญา">		<img src="images/buttomnew3.gif" height="77" width="150" border="0"/>        </a>
        <a href="javascript:show_review(5);" title="ข่าวการศึกษาหลังปริญญา">	<img src="images/buttomnew4.gif" height="77" width="150" border="0"/>	</a>
    <% 
    a="ข่าวประกาศ"
    call b(a) 
    %>
        </td>
      </tr>
    </table>
    
    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="review_3" style="display:none" align="center">
      <tr>
        <td>
       <a href="javascript:show_review(1);" title="ข่าวประชาสัมพันธ์">    <img src="images/buttomnew1.gif"  border="0" height="77" width="150"/> </a>
        <a href="javascript:show_review(2);" title="ข่าวประกาศ">    <img src="images/buttomnew5.gif" height="77" width="150"  border="0"/>    </a>
        <a href="javascript:show_review(3);" title="ข่าวกิจกรรม">    <img src="images/buttomnew2.gif" height="77" width="150" border="0"/>    </a>
        <a href="javascript:show_review(4);" title="ข่าวการศึกษาก่อนปริญญา">		<img src="images/buttomnew3.gif" height="77" width="150" border="0"/>        </a>
        <a href="javascript:show_review(5);" title="ข่าวการศึกษาหลังปริญญา">	<img src="images/buttomnew4.gif" height="77" width="150" border="0"/>	</a>
    <% 
    a="ข่าวกิจกรรม"
    call b(a) 
    %>
        </td>
      </tr>
    </table>
    
    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="review_4" style="display:none" align="center">
      <tr>
        <td>
        <a href="javascript:show_review(1);" title="ข่าวประชาสัมพันธ์">    <img src="images/buttomnew1.gif"  border="0" height="77" width="150"/> </a>
        <a href="javascript:show_review(2);" title="ข่าวประกาศ">    <img src="images/buttomnew5.gif" height="77" width="150"  border="0"/>    </a>
        <a href="javascript:show_review(3);" title="ข่าวกิจกรรม">    <img src="images/buttomnew2.gif" height="77" width="150" border="0"/>    </a>
        <a href="javascript:show_review(4);" title="ข่าวการศึกษาก่อนปริญญา">		<img src="images/buttomnew3.gif" height="77" width="150" border="0"/>        </a>
        <a href="javascript:show_review(5);" title="ข่าวการศึกษาหลังปริญญา">	<img src="images/buttomnew4.gif" height="77" width="150" border="0"/>	</a>
    <% 
    a="ก่อนปริญญา"
    call b(a) 
    %>
        </td>
      </tr>
    </table>
    
    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="review_5" style="display:none" align="center">
      <tr>
        <td>
        <a href="javascript:show_review(1);" title="ข่าวประชาสัมพันธ์">    <img src="images/buttomnew1.gif"  border="0" height="77" width="150"/> </a>
        <a href="javascript:show_review(2);" title="ข่าวประกาศ">    <img src="images/buttomnew5.gif" height="77" width="150"  border="0"/>    </a>
        <a href="javascript:show_review(3);" title="ข่าวกิจกรรม">    <img src="images/buttomnew2.gif" height="77" width="150" border="0"/>    </a>
        <a href="javascript:show_review(4);" title="ข่าวการศึกษาก่อนปริญญา">		<img src="images/buttomnew3.gif" height="77" width="150" border="0"/>        </a>
        <a href="javascript:show_review(5);" title="ข่าวการศึกษาหลังปริญญา">	<img src="images/buttomnew4.gif" height="77" width="150" border="0"/>	</a>
    <% 
    a="หลังปริญญา"
    call b(a) 
    %>
        </td>
      </tr>
    </table>

</td>
</tr>
</table>

<!--#include file="footer.asp"-->



Code (newfunc.asp)
<!--#include file="user/connect.asp" -->

<%
session.CodePage ="65001"
Function b(byref a)
dim strsql,rec
set con = Server.CreateObject("ADODB.Connection")
con.open "DRIVER={MySQL ODBC 5.1 Driver}; SERVER=localhost;UID=root;pwd=admin;database=med;option=16384;"
strsql = "Select * from news,officer where newstype like '%" & a & "%' and news.of_username=officer.of_username Limit 0,50 "
set rec=Server.CreateObject("ADODB.Recordset")
rec.open strsql,con

%>

<table border="0" width="790">
	<tr>
        <th bgcolor="#0066CC"><div align="center" style="color:#FFFFFF" >วันที่ประกาศ</div></th>
        <th  bgcolor="#0066CC"><div align="center" style="color:#FFFFFF">หัวข้อ</div></th>
        <th bgcolor="#0066CC"><div align="center" style="color:#FFFFFF">ผู้ประกาศ</div></th>
    </tr>
<%
	if a="ข่าวประชาสัมพันธ์"  then
	dim z
	while not rec.EOF
%>
	<tr>
    	<td width="200"><div align="center"><%=rec.fields("ddate").value%></div></td>
         <td width="400"><div align="center"><div align="left"><a href="newreport.asp?newid=<%=rec.fields("newsid").value%>" target="_blank" onclick="openWindow()"><%=rec.Fields("title").Value%></a></div></div></td>
        <td width="190"><div align="center"><%=rec.fields("of_name").value%></div></td>
        
<%

rec.movenext
wend
	
elseif a="ข่าวประกาศ"   then
while not rec.EOF
%>
<tr>
    	<td width="200"><div align="center"><%=rec.fields("ddate").value%></div></td>
         <td width="400"><div align="center"><div align="left"><a href="newcall.asp?newcid=<%=rec.fields("newsid").value%>" target="_blank" onclick="openWindow()"><%=rec.Fields("title").Value%></a></div></div></td>
        <td width="190"><div align="center"><%=rec.fields("of_name").value%></div></td>
    </tr>
<%
rec.movenext
wend

elseif a="ข่าวกิจกกรรม"   then
while not rec.EOF
%>
<tr>
    	<td width="200"><div align="center"><%=rec.fields("ddate").value%></div></td>
         <td width="400"><div align="center"><div align="left"><a href="newactivity.asp?newaid=<%=rec.fields("newsid").value%>" target="_blank" onclick="openWindow()"><%=rec.Fields("title").Value%></a></div></div></td>
        <td width="190"><div align="center"><%=rec.fields("of_name").value%></div></td>
    </tr>
<%
rec.movenext
wend

elseif a="ก่อนปริญญา"   then
while not rec.EOF
%>
<tr>
    	<td width="200"><div align="center"><%=rec.fields("ddate").value%></div></td>
        <td width="400"><div align="center"><div align="left"><a href="newbefore.asp?newbid=<%=rec.fields("newsid").value%>" target="_blank" onclick="openWindow()"><%=rec.Fields("title").Value%></a></div></div></td>
        <td width="190"><div align="center"><%=rec.fields("of_name").value%></div></td>
    </tr>
<%
rec.movenext
wend

else
while not rec.EOF
%>
<tr>
    	<td width="200"><div align="center"><%=rec.fields("ddate").value%></div></td>
         <td width="400"><div align="center"><div align="left"><a href="newafter.asp?newfid=<%=rec.fields("newsid").value%>" target="_blank" onclick="openWindow()"><%=rec.Fields("title").Value%></a></div></div></td>
        <td width="190"><div align="center"><%=rec.fields("of_name").value%></div></td>
    </tr>
<%
rec.movenext
wend

end if
%>
</table>

      

<%
'end If
rec.close()
con.close()
set rec=nothing
set con=nothing

End Function
%>




Tag : ASP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-01-24 11:03:08 By : Clamore View : 6977 Reply : 5
 

 

No. 1



โพสกระทู้ ( 297 )
บทความ ( 0 )



สถานะออฟไลน์


แก้ได้แล้วครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-24 15:12:39 By : Clamore
 


 

No. 2



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ตกลงแก้ยังไงครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-24 17:20:32 By : webmaster
 

 

No. 3



โพสกระทู้ ( 297 )
บทความ ( 0 )



สถานะออฟไลน์


ตอนเซฟแอสของ editplus ตรง encoding เลือกเป็น utf8+bom แค่นี้ล่ะครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-25 01:16:08 By : Clamore
 


 

No. 4



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

เยี่ยมครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-25 06:44:07 By : webmaster
 


 

No. 5



โพสกระทู้ ( 27 )
บทความ ( 0 )



สถานะออฟไลน์


ขอบคุณครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-25 16:49:42 By : kanong
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ใช้ UTF8 มันมองหาข้อความไม่เจอ แต่ถ้าใช้ ANSI กับเจอข้อความอ่ะ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่