-1

I inserted this string into mysql database;

Montpellier president Louis Nicollin has revealed his relief at not selling Remy Cabella to Newcastle for €8 million (£6.5m) after the player was called up to France's World Cup squad.

But i found following string when i viewed the database:

Montpellier president Louis Nicollin has revealed his relief at not selling Remy Cabella to Newcastle for �8 million (�6.5m) after the player was called up to France's World Cup squad.

How can i save symbols with other text into my database?

senK
  • 2,782
  • 1
  • 27
  • 38
Kishan KC
  • 1
  • 3
  • 2
    You have an encoding mismatch somewhere in your application. Make sure your database uses the same encoding as wherever you're sourcing your strings from – Bojangles Jun 09 '14 at 06:52

2 Answers2

0

What tool did you use to "view the database" ? It may not work correctly with encodings. Try outputting it with PHP and see it on the page.

Anyways, there's a 100% way to work with ALL possible characters:

  1. Use UTF-8 for the database.
  2. Use UTF-8 for the output

It has work

Oleg Dubas
  • 2,320
  • 1
  • 10
  • 24
0

The problem can be anywhere down the line. Since you don't specify how you insert the data in the database, this example is in php, but it applies to any language.

Pay attention to the following:

  • when you setup the connection, you should set the encoding to utf8 like:

    $pdo = new PDO("mysql:host=localhost;dbname=world;charset=utf8", 'my_user', 'my_pass');

  • make sure your php file is utf-8 encoded. Add following at the start:

    header('Content-Type: text/html; charset=utf-8');

  • Define the database, tables, fields with collation as utf8_general_ci or some other utf8 variation.

Aris
  • 4,643
  • 1
  • 41
  • 38