Wiedmann wrote:- create your table with
- Code: Select all
CREATE TABLE tbl_name (column_list) CHARACTER SET utf8
And if you store or retrieve data to/from the database with PHP, use this as first statement/query after the connection:
- Code: Select all
SET NAMES 'utf8';
That's all.
Done! In my code looks like this (direct copy&paste from .sql file):
- Code: Select all
DROP TABLE IF EXISTS `strings`;
CREATE TABLE `strings` (
`ident` varchar(21) NOT NULL,
`pl` varchar(100) NOT NULL,
`en` varchar(100) NOT NULL,
`fr` varchar(100) NOT NULL,
KEY `ident` (`ident`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
And I use SET NAMES utf8 each time after I connect to database. Still not working!
Wiedmann wrote:Maybe there is allready wrong data in the server. And so this data can't retrieve correctly from the server (anymore).
Rather impossible - because with each and another try, I drop whole database and import it (through phpMyAdmin) again. File (.sql) is encoded in utf8, you said that by default pma imports in utf8. So the only way data is being garbled, is when pma imports it into database. Is it possible?
Wiedmann wrote:Well, but the easiest way is to use allways UTF-8, because you have now only 1 charset for all things and not many. And you can use every language you want with UTF-8.
Yes! Of course! But what to do, if your server admin does not understand this and refuses to configure server properly? :/
Wiedmann wrote:BTW: French have ISO-8859-1 or ISO-8859-15 (like German).
Hm... That's odd! ISO-8859-1 is XHTML equivalent for latin1, yes? Then how to explain situation described by me a few post above:
When I used latin1_general_ci collation I was even unable to store (add, update) text in a row, because each time I tried, I got this error message: "Warning: #1366 Incorrect string value: '\xB3a. Sp...' for column 'fr' at row 1".
I tried to insert some text with French national letters and got such an error message...
Regards,
Tom