1

I'm trying to display double-byte characters in my firemonkey app - windows & android.

Query1.SQL.Text:= 'SELECT ITEM_NAME_KR FROM items WHERE ItemID=1';
Query1.Open;
showmessage( Query1.fieldbyname('ITEM_NAME_KR').AsString );
Edit1.Text := Query1.fieldbyname('ITEM_NAME_KR').AsString;

The MySQL field is set to utf8 with utf8_unicode_ci encoding. I know this is correct because when I update it in MySQL Bench, it displays the double byte correctly in Bench.

I've even tried adding a persistent field for WideString field for ITEM_NAME_KR but it gives me an error : "FDQuery1: Type mismatch for field 'ITEM_NAME_KR', expecting: wideString actual: String".

I've searched quite a few articles but I can't see any special mention of how to display double-byte characters in firemonkey apps - both Windows / Android.

Any ideas what I'm missing?

Peter W.
  • 115
  • 1
  • 8
  • Not quite sure what your problem is, since you didn't post any output from the DB. But since ``Delphi 2009`` the ``string`` type switched to ``Unicode``, so each character is already 2 bytes long! – Delphi Coder Jul 09 '20 at 20:07
  • apologies... the string output was 3 question marks - ??? (there were 3 double-byte characters). would Win32 be an issue? – Peter W. Jul 10 '20 at 00:48
  • No, Win32 is not an issue. – Delphi Coder Jul 10 '20 at 07:37
  • then any reason it just displays a ??? If MySQL WorkBench can display the chinese message, I believe my Delphi apps should be able to display it. Do you have a small sample of an FMX app that can display double byte? – Peter W. Jul 12 '20 at 23:36
  • No, I don't have an example, sry. What happens when you put the DB data in a string var of type ``RawByteString``? – Delphi Coder Jul 15 '20 at 19:54
  • var LName : RawByteString; begin .... LName := lQuery.fieldbyname('ITEM_NAME_KR').value; showmessage( LName ); button2.text := LName; Same output : "???" It doesn't display double-byte, but no issue putting double-byte into the button2.text from Delphi designer itself - will display. It's the MySQL that's giving "???" instead of proper double bytes. – Peter W. Jul 16 '20 at 23:30
  • What **exact** column type and width is the ITEM_NAME_KR column on your server, varchr() or what? And what engine type is it? – MartynA Jul 17 '20 at 07:08
  • it's varchar(100). using innodb – Peter W. Jul 25 '20 at 15:59

0 Answers0