将重音字符从PHP脚本保存到Oracle DB

Cri*_*ris 5 php oracle diacritics

我正在尝试将重音字符(èòàèì)保存到VARCHAR2字段中的Oracle DB; 我已经把

<html>
<head>
   <meta http-equiv="Content-type" value="text/html; charset=utf-8">
</head>
<body>
<?php
 header('Content-type: text/html; charset=utf-8');
Run Code Online (Sandbox Code Playgroud)

.... //在这里我将插入数据库:

$str=utf8_encode("JeanPièrre"); // or $str="JeanPièrre" ... is the same, it does not run
$sql="insert into TABLE(nvar) values('".$str."')";
$stmt = oci_parse($ora_conn, $sql) or die(oci_error().$query);
oci_execute($stmt);
Run Code Online (Sandbox Code Playgroud)

但重音字符没有正确保存,我看到JeanPi ?? rre

我能做什么?请帮助我 :-(

提前致谢 !C.

Ren*_*gen 12

确保您的表具有UTF8字符集,并确保与数据库的连接使用UTF8.在搜索Oracle示例时,我发现了这个:

resource oci_connect  ( string $username  , string $password  [, string $connection_string  [, string $character_set  [, int $session_mode  ]]] )
Run Code Online (Sandbox Code Playgroud)

这将成为类似的东西

$conn = oci_connect('insertUsername', 'insertPassword', 'insertHostname', 'AL32UTF8');
Run Code Online (Sandbox Code Playgroud)

完整文档:

http://nl3.php.net/oci_connect