Recent

Author Topic: DBGrid not supporting Chinese Characters  (Read 589 times)

sfdoony

  • Newbie
  • Posts: 3
DBGrid not supporting Chinese Characters
« on: August 10, 2025, 05:48:34 pm »
Hi Gurus,

Just in the recent I started to develop a program with Lazarus. In DBGrid component, Chinese character always shows as question mark '?'. For example, if the value in database is 你好, showing ??. And, if entering Chinese, it will show question mark/? right away, and question mark will be posted to database.

Here attached the screenshot. In Text and Label can edit/display Chinese characters correctly.

I found in some earlier posts there mentioned converting Chinese when retrieving from database and posting to database. But those are not my case.

I've updated my Lazarus to latest version 4.2.

OS is Windows 10 x64.

Could you please advise or share your experience?

Much appreciated.

wp

  • Hero Member
  • *****
  • Posts: 13355
Re: DBGrid not supporting Chinese Characters
« Reply #1 on: August 10, 2025, 08:41:10 pm »
Which database type are you using?

How are the strings in the Label and the Edit extracted from the database?

When you type Chinese strings in your source code, will they be displayed correctly?

sfdoony

  • Newbie
  • Posts: 3
Re: DBGrid not supporting Chinese Characters
« Reply #2 on: August 11, 2025, 05:51:23 am »
Hi WP,

Sorry my bad, I forgot to explicitly maintain the charset in MySQL57Connection to utf8mb4.

Earlier, elsewhere except DBGrid, Chinese can be displayed correctly.

Now, all good.

Thank you.

 

TinyPortal © 2005-2018