0

I have the following query against a database of Chinese characters, where py -- is the transcription.

cursor.execute('''' SELECT * FROM words_ch WHERE py LIKE %s''', (str(word),'')))

As we know there in Chinese are several tones: ā, á, ǎ, à etc.

I expected to get strings where py == māo, but I get strings with all tones māo máo máo mǎo mào.

What is this related to?

Is it possible to fix it so that the query accuracy is higher?

azro
  • 53,056
  • 7
  • 34
  • 70
  • Why do you pass a tuple `(str(word),'')` of 2 values whereas there is only one `%s` ? – azro Jul 30 '23 at 07:57
  • The duplicate explains why you need utf8 on the server and connection string, you van check the documentation how to set utf8 in the connection dtring – nbk Jul 30 '23 at 08:14

0 Answers0