我正在特林增加 「翻訳するテキストや網絡ページ」 到PostgreSQL表,但這個樣子的:如何使用PHP將日文文本插入到Postgres表中?
"& #32763;""& #35379;"す& #12427;テ& #12461;& #12473;& #12488;& #12420;Web& #12506;& #12540;& #12472;
我怎樣才能插入,在正確的格式?
<?php
$db = pg_connect("host=localhost port=5432 dbname=lang user=password=") or die(":(");
pg_set_client_encoding($db , "UTF-8");
#pg_exec($db,"SET NAMES 'UTF-8'");
#pg_exec($db,"SET CLIENT_ENCODING TO 'UTF-8'");
//$lan=iconv("UTF-8",'ISO-8859-1//TRANSLIT',$_REQUEST['lan']);
$lan=$_REQUEST['lan'];
echo $lan;
if(array_key_exists('sub',$_REQUEST))
{
$sql="INSERT INTO table1 (japan) VALUES('{$lan}')";
pg_query($sql) or die("errot");
}
?>
<html>
<body>
<form action="" method="">
<input type="text" name="lan" />
<input type="submit" name="sub" />
</form>
</body>
</html>
我需要使用哪種歸類? – coderex 2009-06-27 11:51:21
- - PostgreSQL數據庫轉儲 - - 開始於2009-06-27 17點22分32秒 SET CLIENT_ENCODING = 'utf-8'; SET standard_conforming_strings = off; SET check_function_bodies = false; SET client_min_messages = warning; SET escape_string_warning = off; SET search_path = public,pg_catalog; SET default_tablespace =''; SET default_with_oids = false; - - TOC entry 1466(class 1259 OID 71803) - 依賴項:3 - 名稱:table1;類型:TABLE;架構:公開;所有者:prasanth;表空間: - CREATE TABLE table1( id integer NOT NULL, japan character(1000) ); – coderex 2009-06-27 11:53:32