Jump to content
php.lv forumi

kodējums DB+SQL


intero

Recommended Posts

Sveiki! Šī tēma ir aprakstīta krustām šķērsām, tomēr problēmas risinājumu es neesmu atradis.

OS kur problēma novērota: Ubuntu.

Apache2:

AddDefaultCharset UTF-8

AddCharset UTF-8 .utf8

 

MySQL5:

Server variables and settings

.....

character set client utf8

(Global value) latin1

character set connection utf8

(Global value) latin1

character set database latin1

character set filesystem binary

character set results utf8

(Global value) latin1

character set server latin1

character set system utf8

character sets dir /usr/share/mysql/charsets/

collation connection utf8_bin

(Global value) latin1_swedish_ci

collation database latin1_swedish_ci

collation server latin1_swedish_ci

........

 

 

Problēma sekojoša:

index.php kods(kodēts utf-8)

<?

$user = 'root';
$passwd = '0000';
$hostname = 'localhost';

$d_base = 'test';


mysql_connect ($hostname,$user,$passwd) or die('Nevar pieslēgties serverim');
mysql_select_db ($d_base) or die ('Nevar pieslēgties datubāzie');

?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?
$sql = mysql_query('SELECT * FROM aaa'); 
	if($sql){
		while ($s = mysql_fetch_array($sql))	{ 
			echo $
600
;s[0] . ' > '. $s[1] .'<br>';
		}
	}
	else { echo 'wtf '; }

echo 'šņāceņi';
?>

 

MySQL DUMPS

-- 
-- Database: `test`
-- 

-- --------------------------------------------------------

-- 
-- Table structure for table `aaa`
-- 

CREATE TABLE `aaa` (
 `name` varchar(255) collate utf8_bin NOT NULL,
 `text` varchar(255) collate utf8_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- 
-- Dumping data for table `aaa`
-- 

INSERT INTO `aaa` VALUES (0xc4bcc5a1c5a1c586c5a1c586c4b7c481c5be, 0xc5a1c4a3c481c481c481c493c5be);
INSERT INTO `aaa` VALUES (0xc4bcc4b7c4bcc5bec4b7c4b7c5a1c5a1c481c586, 0x6473646664c5a166c5a1647366c5a1);

 

Problēma izpaužās, ka web lapa atspoguļo sekojošo:

 

?��?�???� > �?????�

???�??��?? > dsdfd�f�dsf�

šņāceņi

 

Kādi komentāri?

 

P.S.

man nepatīk tas Latin1 Gobālajos Values.

Link to comment
Share on other sites

jau ieprieksh Dumpu raxtiiju.

 

CREATE DATABASE `test` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;

CREATE TABLE `aaa` (
`name` VARCHAR( 255 ) NOT NULL ,
`text` VARCHAR( 255 ) NOT NULL
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_bin;

Link to comment
Share on other sites

paldies par "lielo atsaucību"!

lai nu kā - konstatēju, ka veicot INSERT INTO datubāzē, dati pie SELECTa atgriežas pareizi. Šādā veidā viss sanāk.

 

Tomēr, šāda postojot datus mums visiem labi zināmai riks phpMyAdmin atgriež ievadītos datu neapotamos sīmbolos.

ir kādi ieteikumu sakarā ar phpMyAdmin?

Edited by intero
Link to comment
Share on other sites

×
×
  • Create New...