user75472
user75472

Reputation: 1295

How to insert special characters in database?

I have characters like ó, ö and so on. When i insert these data into the table it displays like these ó ö. I am using php mysql. Is there any solution for this???

Upvotes: 2

Views: 8972

Answers (3)

karim79
karim79

Reputation: 342635

Run this query to check MySQL's various character encoding settings:

show variables like '%character%'

I would say you've probably got one or more of those set to latin1. Also, try executing these queries prior to inserting/fetching data:

SET NAMES utf8
SET CHARACTER SET utf8

Upvotes: 0

chaos
chaos

Reputation: 124297

Depends on your database engine. For MySQL, the solution is usually to set your table's default character set, like so:

CREATE TABLE `foo` (
    `bar` varchar(20) not null
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Upvotes: 0

Alex Martelli
Alex Martelli

Reputation: 881645

Please specify what DB system you're using -- each has its preferred way to specify character encoding. Then, set the character encoding of your DB to the same you're using for sending it the strings -- the latter may depend on your language and library, so if you want detailed help you'd better specify those too.

Upvotes: 1

Related Questions