0

I have a table called Traduction with these two rows :

francais     |espagnol         |allemand       |anglais  
-------------+-----------------+---------------+----------------
ORANGE litée |NARANJA ENCAJADA |ORANGEN GELEGT |ORANGE 1 LAYER
ORANGE LITEE |NARANJA ENCAJADA |ORANGEN GELEGT |ORANGE 1 LAYER

My query is :

SELECT * FROM T_TRADUCTION where francais= 'ORANGE LITEE';

This query returns two rows of the table, whereas it should return only the record with ORANGE LITEE value (not ORANGE litée).

I don't understand why.

frlan
  • 6,950
  • 3
  • 31
  • 72
user1260928
  • 3,269
  • 9
  • 59
  • 105

3 Answers3

1

Change your database collate to latin1_general_cs

Set your database DEFAULT CHARACTER to latin1

Now execute your query.

SELECT * FROM T_TRADUCTION where francais= 'ORANGE LITEE';
shA.t
  • 16,580
  • 5
  • 54
  • 111
0

Try to correct it like this :

SELECT * FROM T_TRADUCTION where francais='ORANGE litée';

Best Regards.

laymo
  • 17
  • 7
0

Getting encoding right is tricky, there are too many layers: Browser, Page, PHP, MySQL.

You need to check in what encoding the data flow at each layer.

Check HTTP headers, headers. Check what's really sent in body of the request. Don't forget that MySQL has encoding almost everywhere: Database Tables Columns Server as a whole Client Make sure that there's the right one everywhere.

From manual>

SET NAMES indicates what character set the client will use to send SQL statements to the server. Thus, SET NAMES 'cp1251' tells the server, “future incoming messages from this client are in character set cp1251.” It also specifies the character set that the server should use for sending results back to the client. (For example, it indicates what character set to use for column values if you use a SELECT statement.)

Brane
  • 3,257
  • 2
  • 42
  • 53