문제

I have one big problem.

My databases column look like this:

{"79":"novej nazev ","53":"","54":"0","55":"0","56":"\u0159\u0159\u0159\u0159\u0159","57":"","58":"","59":"","60":"","61":"","62":"","63":"","64":"","65":"","66":"","67":"","68":["",""],"69":"0","70":["",""],"71":["",""],"72":["",""]}

There is array and json_encode(array)

So now I would like search in database some word with diacritics but json_encode convert diacritics to (\u0159\u0159\u0159\u0159\u0159)

Ok no problem so I was convert searchs word by $search_word=json_endoce(SEARCH WORD);.

Now I will seach by script: data LIKE '%$search_word%' but nothing so will not get forim database

So where i have been doing wrong?

도움이 되었습니까?

해결책

I suggest you to not escape unicode characters with json_encode :

json_encode($value, JSON_UNESCAPED_UNICODE);

Unicode is well supported in MySQL. You don't need to escape those characters.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top