|
 |
|
call Ajax php แล้ว ข้อมูลมันเพี้ยน คือ ภาษาไทยมันเพี้ยน พร้อมรูปปัญหา |
|
 |
|
|
 |
 |
|
ถ้าเป็น <meta http-equiv="Content-Type" content="text/html"; charset="tis-620">
ie , Firefox จะมีปัญหา
แต่ google chrome ไม่มีปัญหา
ถ้าเป็น <meta http-equiv="Content-Type" content="text/html"; charset="utf-8">
ie , Firefox ,google chromeจะมีปัญหา
|
 |
 |
 |
 |
Date :
2012-09-02 19:06:24 |
By :
onilne |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอา Code มาดู
|
 |
 |
 |
 |
Date :
2012-09-02 20:13:47 |
By :
Krungsri |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้ลองใช้ editPlus save as
Encoding เป็น utf8 แล้วหรือยัง
|
 |
 |
 |
 |
Date :
2012-09-02 23:13:14 |
By :
iieszz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<meta http-equiv="Content-Type" content="text/html"; charset="tis-620">
<?php
$objConnect = mssql_connect("0.0.0.0","...","...") or die("Error Connect to Database");
if(!$objConnect)
{
die('NOT CONNECT'.mysql_error());
}
mssql_select_db("tDWDatabase");
?>
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
Code (PHP)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html"; charset="tis-620">
<script type="text/javascript">
function showuser()
{
var url="pack_GFMIS3.php";
var parameter="username=0";
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("maincontent1").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("POST",url,true);
xmlhttp.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send(parameter);
}
</script>
</head>
<body>
<div id="container">
<div id="sidebar1">
Name:<input type="text" name="username"/>
Password:<input type="text" name="password"/>
<center><input type="submit" value ="กรุณาเลือก" onclick ='showuser();'/>
</div>
<div id = "maincontent1"></div>
<div >
<iframe id = "maincontent2" width = 500 frameborder =0 > </iframe>
</div>
</div>
</body>
</html>
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
Code (PHP)
<meta http-equiv="Content-Type" content="text/html"; charset="tis-620">
<?
include 'connect.inc.php';
$id_GFMIS_Department = $_GET[id_GFMIS_Department];
$sql="SELECT distinct [Name] AS [BudgetDetailName] ,[ID] AS [IDBudgetDetail] FROM [tDWDatabase].[dbo].[DimBudgetDetail] ORDER BY Name";
$rs=mssql_query($sql);
$html.="<font>เลือกประเภท</font> <br /> <select id='GFMIS_Budget' onChange='ShowBudgetValue(this.value)';>
<option value=''>กรุณาเลือก</option>";
while($row=mssql_fetch_array($rs)){
$html.="<option value='".$row[IDBudgetDetail]."'>".$row[BudgetDetailName].")</option>";
}
$html.="</select>";
echo $html;
?>
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
ตอนนี่ charset="tis-620" ได้ดังตัวอย่างที่โพสไว้
ทุกอย่างมีการ save as Encoding ทุกอย่างตาม charset หมด มันติดอย่างเดียวทำทำไงให้ข้อมูลที่ดึงมาจาก
Database แปลงไปเป็น รูปแบบของ utf-8 ให้ได้ แต่ผมทำไม่ได้
|
 |
 |
 |
 |
Date :
2012-09-02 23:48:09 |
By :
onlinenow |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใช้ tis-620 ทุกๆ ส่วน
|
 |
 |
 |
 |
Date :
2012-09-03 07:45:15 |
By :
กร |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อืม ใช้ทุกส่วน ทั้งประกาศ หัว และ encoding
|
 |
 |
 |
 |
Date :
2012-09-03 12:38:28 |
By :
onlinenow |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ฝั่ง ajax เท่าที่ผมทำต้อง utf-8 อย่างเดียวจ้า
ทำตามนี้เลยจ้า
Code (PHP)
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?
$connect = $objconnect = mysql_connect("localhost","root") or die("Error Connect to Database");
mysql_query("SET NAMES 'TIS-620'",$connect);
$objDB = mysql_select_db("apartment")or die(mysql_error());
?>
ฝั่งแสดงค่าจะอะไรก็ได้จ้า TIS-620 หรือ UTF-8
มอเตอร์ไซค์รับจ้างไปแล้วจ้า ติ๋ว ติว ติว ติว
|
 |
 |
 |
 |
Date :
2012-09-03 13:22:51 |
By :
vissarud |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|