Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Emoticons

Questions related to using nuBuilder Forte.
Post Reply
shuray
Posts: 30
Joined: Sun Apr 23, 2023 3:36 pm
Has thanked: 10 times
Been thanked: 5 times

Emoticons

Unread post 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 :(
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Emoticons

Unread post by kev1n »

Hi,

Have you tried other collations such as utf8mb4_unicode_ci ?
shuray
Posts: 30
Joined: Sun Apr 23, 2023 3:36 pm
Has thanked: 10 times
Been thanked: 5 times

Re: Emoticons

Unread post 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 :(
shuray
Posts: 30
Joined: Sun Apr 23, 2023 3:36 pm
Has thanked: 10 times
Been thanked: 5 times

Re: Emoticons

Unread post by shuray »

and for utf8mb4_bin - no changes
shuray
Posts: 30
Joined: Sun Apr 23, 2023 3:36 pm
Has thanked: 10 times
Been thanked: 5 times

Re: Emoticons

Unread post by shuray »

Note: the database itself stores correct strings, but there is some problem on the fence between the application and the sql
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Emoticons

Unread post 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';
shuray
Posts: 30
Joined: Sun Apr 23, 2023 3:36 pm
Has thanked: 10 times
Been thanked: 5 times

Re: Emoticons

Unread post by shuray »

The same. I had modified and have restarted. THere are no differences
shuray
Posts: 30
Joined: Sun Apr 23, 2023 3:36 pm
Has thanked: 10 times
Been thanked: 5 times

Re: Emoticons

Unread post 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?
Post Reply