php-src/ext/mysqli/tests/065.phpt
Georg Richter 49e1484da8 - fixed compile error under windows. Functionality for changing the
character set was moved to libmysql (4.1 bk tree - will be merged into
5.0 within the next days).
- renamed mysql_set_character_set to mysqli_set_charset
2005-05-13 13:11:41 +00:00

38 lines
743 B
PHP

--TEST--
set character set
--SKIPIF--
<?php
require_once('skipif.inc');
?>
--FILE--
<?php
include "connect.inc";
$mysql = new mysqli($host, $user, $passwd);
$esc_str = chr(0xbf) . chr(0x5c);
if ($mysql->set_charset("latin1")) {
/* 5C should be escaped */
$len[0] = strlen($mysql->real_escape_string($esc_str));
$charset[0] = $mysql->client_encoding();
}
if ($mysql->set_charset("gbk")) {
/* nothing should be escaped, it's a valid gbk character */
$len[1] = strlen($mysql->real_escape_string($esc_str));
$charset[1] = $mysql->client_encoding();
}
$mysql->close();
var_dump($len[0]);
var_dump($len[1]);
var_dump($charset[0]);
var_dump($charset[1]);
?>
--EXPECT--
int(3)
int(2)
string(6) "latin1"
string(3) "gbk"