WebsiteBaker Support (2.10.x) > General Help & Support

Again Cyrillic entries error

(1/4) > >>

rumen:
I got again Cyrillic entries in Bakery 1.83 in the order form error but this time the problem is not in the DB table collation and not in the template ... so what I miss?

Rumen

Gast:
Bakery is prepared for Latin characters only

here the form-check from save_form.php for the company field


--- Code: ---if (!preg_match('#^[\p{Latin}'.$us.'0-9.+&\s\-]{0,50}$#u', $value)) {
--- End code ---

you can try it with this


--- Code: ---if (!preg_match('#^[\p{Cyrillic}+|\p{Latin}'.$us.'0-9.+&\s\-]{0,50}$#u', $value)) {
--- End code ---
but not sure, not possible, to test it for me at the moment

P.S.: there are a lot of field checks for nearly every field, be very carefull with this and try to understand first,  how the preg_match works in every check
for example:
country - allowed only two letters A-Z

--- Code: ---if (!preg_match('#^[A-Z]{2}$#u', $value)) {
--- End code ---

maybe it works with

--- Code: ---if (!preg_match (#^[a-zA-Z\p{Cyrillic}\d\s\-]+$/u', $value)) {
--- End code ---

or with this for Latin Users also

--- Code: ---if (!preg_match('#^[\p{Cyrillic}+|\p{Latin}'.$us.'0-9.+&\s\-]{2}$#u', $value)) {
--- End code ---

go step by step and check the form after every chenges in the field check

rumen:
I have changed the fields, but got same error. I remember I got the same error before, but it was in ver. 1.77. Now this is ver. 1.83, otherwise I would copy the files from the other one that works :(

rumen:
In this file save_form.php I see there is Cyrillic support.

Gast:
plaese change this code for a test to


--- Code: ---if (!empty($MOD_BAKERY['ADD_CHARSET'])) {
    switch (strtolower($MOD_BAKERY['ADD_CHARSET'])) {
        case 'cyrillic':
//            $us = '\p{Cyrillic}';
            $us = '+|\p{Cyrillic}';
            break;
        case 'greek':
//            $us = '\p{Greek}';
            $us = '+|\p{Greek}';
            break;
        case 'hebrew':
//            $us = '\p{Hebrew}';
            $us = '+|\p{Hebrew}';
            break;
        case 'arabic':
//            $us = '\p{Arabic}';
            $us = '+|\p{Arabic}';
            break;
    }
}
--- End code ---

works for me with a regex-tester

Navigation

[0] Message Index

[#] Next page

Go to full version