Buy Now
Sign in

UTF8 in database

Le Pache , March 18 at 12:42
L
Le Pache 53
March 18 at 12:42 #384983
Hi everybody,
I'm having a problem with the UTF8 characters saved in database. They are in UTF8 in sended mail. That is what the debugger shows :
Array
(
[option] => com_chronoforms6
[chronoform] => ...
[event] => submit
[1] => Array
(
[0] => Est agréable à vivre
)
[save_data12] => Array
(
[data] => Array
(
[created] => 2019-03-18 12:31:07
[user_id] => 0
[ip_address] => ...
[1] => ["Est agr\u00e9able \u00e0 vivre"]
[email8] => Array
(
[recipients] => Array
(
[0] => xxx@xxx.com
)

[subject] => ...
[body] =>
<table width="100%" cellpadding="5" cellspacing="3" border="0" class="ui table"><tr><td width="30%" valign="top" align="right"><strong>1 - ....</strong></td><td width="70%" valign="top" align="left">Est agréable à vivre</td></tr><tr><td width="30%" valign="top" align="right">
Thanks for help !
admin 27.0
March 18 at 18:48 #384994
How is the data displayed in the table manager in the admin area ?
Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
healyhatman 6.0
March 19 at 05:10 #385009
https://stackoverflow.com/questions/202205/how-to-make-mysql-handle-utf-8-properly
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
L
Le Pache 53
March 19 at 07:45 #385015
In admin area, data are displayed like this :
Est agr\u00e9able \u00e0 vivre
Thank you for your help Max
L
Le Pache 53
March 19 at 08:01 #385016
Thanks healyhatman.
I've changed my data incoding in phpmyadmin from utf8_general_ci to utf8mb4_general_ci and tried utf8mb4_unicode_ci also, but it does not change anything.
healyhatman 6.0
March 19 at 08:17 #385018
What happens if you use
echo utf_encode($this->data("name_of_your_form_field"));
In a PHP block? Or utf_decode?
Also does https://www.toptal.com/php/a-utf-8-primer-for-php-and-mysql help
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
L
Le Pache 53
March 19 at 21:17 #385069
The variable itself seems fine :
Echo : Est agréable à vivre
Encode : Est agréable Ã&nbsp; vivre
Decode : Est agr�able � vivre
I don't have control over the database parameters, but the fields are UTF-8. The rest of joomla works with the same database link, so I guess the parameters are fine.
Please note that in my Debugger output, the first block is fine while the second isn't. Is that a database read, or the data as it is to be sent to the DB ?
admin 27.0
March 25 at 19:42 #385242
1
I think this is a bug with the latest one or two updates but a fix should be available in the next update!
Best regards
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
L
Le Pache 53
April 04 at 08:52 #385511
Thanks Max for the update. It's ok now for UTF8.
I still have a problem : a SQL 1064 error message. Could it be possible that ( or / in text field produce this error ?
GreyHead 63.5
April 04 at 10:01 #385517
Hi LePache,
I think a 1064 message is a syntax error - if you add a Debugger to your form temporarily you should see the SQL query that is being created. That will help you pin down where the error is occurring.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
healyhatman 6.0
April 04 at 10:12 #385519
Unfortunately v6 data actions aren't caught and cause a fatal error so you won't see any debug or anything. Which I've requested Max change.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
GreyHead 63.5
April 04 at 10:13 #385520
Hi healyhatman,
Hmmm . . . does the Joomla! debugger show the query? That might help.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
L
Le Pache 53
April 05 at 13:20 #385634
Hi everybody,
I still have this red message of SQL error. And of course,I can't see the debugger when it occurs.
the form does not pass the first time and then passes with the same data once next.
The error is always of the same type. A field (checkbox or radio) then a number between ' ' (which is not a data entered in the form) then the contents of other fields (the last is cut).
I do not understand at all what can generate this error.I removed all the special characters from the options of chechboxes or radios ...
Please help ! My client becomes crazy...
SQLerror.png
Attachments
SQLerror.png
SQLerror.png
(35.11 KiB)
60 Downloads/Views
L
Le Pache 53
April 05 at 13:28 #385635
One more ...
SQLerror2.png
Attachments
SQLerror2.png
SQLerror2.png
(4.7 KiB)
61 Downloads/Views
L
Le Pache 53
April 11 at 14:48 #385832
1
 Answer
I finally found the cause of the SQL error.
WARNING: the name of the fields must not start with a number, which is not specified in CF6!
And since the name of the field is automatically generated with the label, if it starts with a number (eg the number of the question), this causes SQL errors!
It would be nice to test (as in CF5) that the name does not start with a number ...