likemike Posted June 17, 2022 Share Posted June 17, 2022 Hello! Does anyone knows a way how to save Emojis, which are entered in an UnimEdit to database and to display them later f.ex. in an UnimMemo? When I use an UnimEdit, you can insert Emojis on Smartphones. When I save the UnimEdit.Text in a database field and load it back to a memo field there are ???? displayed instead of the emojis. I figuered out, that the Emojis are represented by 2 hex values each. When saving it to a database field the hex pairs are replaced to ?-signs. Regards Mike Link to comment Share on other sites More sharing options...
likemike Posted June 18, 2022 Author Share Posted June 18, 2022 It has something to do with Unicode and the character set of the database field. I use Firebird 3.0.3 and I've changed the charcter set - actually without success. I keep searching... Link to comment Share on other sites More sharing options...
Sherzod Posted June 18, 2022 Share Posted June 18, 2022 2 minutes ago, likemike said: I've changed the charcter set UNICODE_FSS ? 1 Link to comment Share on other sites More sharing options...
likemike Posted June 18, 2022 Author Share Posted June 18, 2022 Yes! That's it. SQL: ALTER TABLE "T_Table" ALTER COLUMN TEXT_FIELD TYPE VARCHAR(8192) CHARACTER SET UNICODE_FSS COLLATE UNICODE_FSS But you have to delete existing data, because it's not compatible. Link to comment Share on other sites More sharing options...
likemike Posted June 18, 2022 Author Share Posted June 18, 2022 Unfortunately the change of the character set ends in an [FAC]: "Malformed string"-exception when national characters like "ä", "é", "ñ" etc. are used. Any suggestions? Link to comment Share on other sites More sharing options...
Sherzod Posted June 18, 2022 Share Posted June 18, 2022 What component are you using to connect to the database? Are you using the Unicode_FSS charset when connecting? Link to comment Share on other sites More sharing options...
likemike Posted June 18, 2022 Author Share Posted June 18, 2022 I use FireDAC. I need the Unicode character set only for one field. Link to comment Share on other sites More sharing options...
likemike Posted June 18, 2022 Author Share Posted June 18, 2022 I've tried it with character set UTF8, but with the same result: Emojis are working, characters between chr(20) and chr(127) are working, but not characters above. Link to comment Share on other sites More sharing options...
Sherzod Posted June 18, 2022 Share Posted June 18, 2022 Link to comment Share on other sites More sharing options...
likemike Posted June 18, 2022 Author Share Posted June 18, 2022 Yes - but that's for the whole database. I don't want Unicode for the whole db. I only need Unicode to store the Emojis. And that's in a single field. In Firebird you can define the character set for each field seperately, but as I said - it doesn't work. So this is more a FireDAC problem, than a problem with UniGui. Link to comment Share on other sites More sharing options...
Sherzod Posted June 18, 2022 Share Posted June 18, 2022 11 minutes ago, likemike said: I don't want Unicode for the whole db. I only need Unicode to store the Emojis. You won't be able to connect like this, I guess. Link to comment Share on other sites More sharing options...
likemike Posted June 18, 2022 Author Share Posted June 18, 2022 I've got the solution: ALTER TABLE "T_Table" ALTER COLUMN TEXT_FIELD TYPE VARCHAR(8192) CHARACTER SET OCTETS COLLATE OCTETS The “trick” is to use character set OCTETS. Because OCTETS is a special character set that blindly stores only what you poke into it—without transliteration—it is ideal for making the character codes neutral with respect to code page. Link to comment Share on other sites More sharing options...
Sherzod Posted June 18, 2022 Share Posted June 18, 2022 1 minute ago, likemike said: The “trick” is to use character set OCTETS. Because OCTETS is a special character set that blindly stores only what you poke into it—without transliteration—it is ideal for making the character codes neutral with respect to code page. Okay. Very good. Link to comment Share on other sites More sharing options...
Recommended Posts