1

In database fields are characters to html entities converted, so if I try to search for words like übung or ärzte nothing is found. I tried to add in my SQL query COLLATE utf8_general_ci but I get there following error: COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'latin1'

My fields what I search are in utf8_general_ci encoding.

Is there possible to make such search or to convert by submit some letters to html entities?

nowilius
  • 131
  • 1
  • 13
  • So your strings contain something like `'Ä'` or `'Ä' `. Changing the collation will not help here as the characters will stay the same. What you need is a HTML conversion obviously. So either build some function for this or solve this outside the database or store both the HTML string and the real string for searching (or only the real string for that matter; you can always convert it when you need HTML). – Thorsten Kettner May 24 '17 at 21:34

1 Answers1

0

https://dev.mysql.com/doc/refman/5.7/en/charset-literal.html

A nonbinary string with latin1 character set and latin1_german1_ci collation:

SELECT _latin1'übung' COLLATE latin1_german1_ci;

result
übung

check your database collation

https://makandracards.com/makandra/2529-show-and-change-mysql-default-character-set

SHOW VARIABLES LIKE  'char%';

I reckon you are set with latin1 so you can only use latin1 ... if utf8 then should allow you.

RoMEoMusTDiE
  • 4,739
  • 1
  • 17
  • 26