Page 1 of 1

Emoticons

Posted: Thu Nov 30, 2023 6:13 am
by shuray
Hi!
I'm trying to store in text fields some special symbols AKA emoticons (sure along with other latin and cyrillic chars). And I can't do it yet
Right now I'm testing the following dummy set: Hi-β€οΈπŸ’‹πŸ™ŠβŒπŸͺ“πŸ’©πŸ‘»πŸ’€β˜ οΈπŸ‘₯πŸ‘πŸ‘…-ΠšΠΎΠ½Π΅Ρ†

My steps just after running the new nuBuilder instance v. 4.5.8.1:
1. Check MariaDb settings in phpAdmin:
1.1. Server connection collation: utf8mb4_unicode_ci
1.2. Database sqlu collation: utf8mb4_general_ci

2. Create by phpAdmin a new table tbl_Test:
2.1. CREATE TABLE `sqlu`.`tbl_Test` (`id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(1000) NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;
2.2. Checked a collation: tbl_Test.name is utf8mb4_general_ci

3. Insert 1 row by phpAdmin: INSERT INTO `tbl_Test` (`id`, `name`) VALUES (NULL, 'Hi-β€οΈπŸ’‹πŸ™ŠβŒπŸͺ“πŸ’©πŸ‘»πŸ’€β˜ οΈπŸ‘₯πŸ‘πŸ‘…-ΠšΠΎΠ½Π΅Ρ†')

4. Test inserting:
4.1. SELECT name FROM tbl_Test;
4.2. Everything is OK: > Hi-β€οΈπŸ’‹πŸ™ŠβŒπŸͺ“πŸ’©πŸ‘»πŸ’€β˜ οΈπŸ‘₯πŸ‘πŸ‘…-ΠšΠΎΠ½Π΅Ρ†

That's fine here
===================

Next steps in nuBuilder:
5. Create a new FastForm for tbl_Test with only one text field 'name'

6. Browse it. I see: Hi-❀️??❌????☠️???-ΠšΠΎΠ½Π΅Ρ†

7. Trying inserting a new record with the same original test string using this FastForm.
7.1.Nothing inserted, but nuDebugResults reports:

Code: Select all

	[0] : ===PDO MESSAGE===
	SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\xF0\x9F\x92\x8B\xF0\x9F...' for column `sqlu`.`zzzzsys_debug`.`deb_message` at row 1
	===SQL===========
	INSERT INTO zzzzsys_debug (zzzzsys_debug_id, deb_message, deb_added, deb_user_id) VALUES (:id , :message, :added, :user_id)
	===BACK TRACE====
	/var/www/html/core/nudatabase.php - line 496 (nuRunQuery)
	/var/www/html/core/nudatabase.php - line 546 (nuDebugResult)
	/var/www/html/core/nudatabase.php - line 157 (nuDebug)
	/var/www/html/core/nudata.php - line 580 (nuRunQuery)
	/var/www/html/core/nudata.php - line 459 (nuUpdateDatabaseExecStatements)
	/var/www/html/core/nuapi.php - line 116 (nuUpdateDatabase)
8. OK, I've changed collation for zzzzsys_debug table to utf8mb4_general_ci using phpAdmin and restarted services.
9. No changes :(

Re: Emoticons

Posted: Thu Nov 30, 2023 8:15 am
by kev1n
Hi,

Have you tried other collations such as utf8mb4_unicode_ci ?

Re: Emoticons

Posted: Thu Nov 30, 2023 12:58 pm
by shuray
Hi, kevin,
I just tried to cchange collation all of all to utf8mb4_unicode_ci: database itself, Server connection collation, tbl_Test (table and fields), zzzzsys_debug (and, honestly, for all tables of database)

there are no differences :(

Re: Emoticons

Posted: Thu Nov 30, 2023 1:00 pm
by shuray
and for utf8mb4_bin - no changes

Re: Emoticons

Posted: Thu Nov 30, 2023 1:43 pm
by shuray
Note: the database itself stores correct strings, but there is some problem on the fence between the application and the sql

Re: Emoticons

Posted: Thu Nov 30, 2023 2:31 pm
by kev1n
What if you set the utf8mb4 character set in nubuilder_session_data.php?

Replace:

Code: Select all

$this->nubuilder['DB_CHARSET']				= 'utf8';
with:

Code: Select all

$this->nubuilder['DB_CHARSET']				= 'utf8mb4';

Re: Emoticons

Posted: Thu Nov 30, 2023 3:12 pm
by shuray
The same. I had modified and have restarted. THere are no differences

Re: Emoticons

Posted: Sun Dec 03, 2023 10:52 am
by shuray
kev1n wrote: ↑Thu Nov 30, 2023 2:31 pm What if you set the utf8mb4 character set in nubuilder_session_data.php?
Kev1n, it looks like in nudatabase.php the nubuilder_session_data.php was not executed yet and therefore the code
nudatabase.php:

Code: Select all

$DBCharset		= $sessionData['DB_CHARSET'] ?? 'utf8'; 
appears with empty $sessionData['DB_CHARSET'] even if I set up it in nubuilder_session_data.php

But if I do the change in nudatabase.php inself like:

Code: Select all

$DBCharset		= $sessionData['DB_CHARSET'] ?? utf8mb4'; 

then everything looks perfect!

Thank you. Probably, it is reasonable to have a parameter - which charset will be used on the nubuilder instance?