Καλησπέρα, κάποιος με mac και εγκατεστημένη PHP lo...
# chat
e
Καλησπέρα, κάποιος με mac και εγκατεστημένη PHP locally (homebrew ή με άλλο τρόπο, αλλά στο mac, όχι σε κάποιο container) που μπορεί να τρέξει λίγες γραμμές για να επιβεβαιώσει κάτι?
m
πες μου @efpapado
e
Τρέξε με κάποιον τρόπο (drush, controller, οτιδήποτε) αυτό:
Copy code
$html_string = "<p>example with a NBSP here: &nbsp; for testing</p>";
    $decoded = Html::decodeEntities($html_string);

    $without_modifier = preg_replace('/\s+/', ' ', $decoded);
    $json1 = json_encode($without_modifier);
    $with_modifier = preg_replace('/\s+/u', ' ', $decoded);
    $json2 = json_encode($with_modifier);
και πες μου αν το $json1 είναι false
και μετά τρέξε επίσης αυτό:
Copy code
drush php:eval "print_r(parse_url('internal:/landsdeler/Østlandet'))"
και πες μου αν στο path θα δεις encoding problem στο Østlandet (π.χ. εγώ παίρνω
Copy code
/landsdeler/�_stlandet
)
m
θελει
$decoded = \Drupal\Component\Utility\Html::decodeEntities($html_string);
ετσι;
e
ναι sorry, το έκανα copypaste
m
Copy code
cat x.php
<?php

 $html_string = "<p>example with a NBSP here: &nbsp; for testing</p>";
    $decoded = \Drupal\Component\Utility\Html::decodeEntities($html_string);

    $without_modifier = preg_replace('/\s+/', ' ', $decoded);
    $json1 = json_encode($without_modifier);
    $with_modifier = preg_replace('/\s+/u', ' ', $decoded);
    $json2 = json_encode($with_modifier);

var_dump($json_1);


var_dump($json2);


➜ ✗ ./vendor/bin/drush scr x.php
 [warning] Undefined variable $json_1 x.php:11
NULL
string(47) ""<p>example with a NBSP here: for testing<\/p>""
sorry, εχω typo
Copy code
string(54) ""<p>example with a NBSP here: \u00a0 for testing<\/p>""
string(47) ""<p>example with a NBSP here: for testing<\/p>""
e
which php
m
8.2.28
e
8.3.24 εδώ ..
m
Copy code
➜  ProductPitDrupal git:(frontend_imrpovements) ✗ ./vendor/bin/drush php:eval "print_r(parse_url('internal:/landsdeler/Østlandet'))"
Array
(
    [scheme] => internal
    [path] => /landsdeler/Østlandet
)
κατσε να αλλαξω php
Copy code
➜  php -v
PHP 8.3.20 (cli) (built: Apr  8 2025 20:21:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.20, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.20, Copyright (c), by Zend Technologies
    with Xdebug v3.3.2, Copyright (c) 2002-2024, by Derick Rethans
➜  ✗ ./vendor/bin/drush scr x.php
string(54) ""<p>example with a NBSP here: \u00a0 for testing<\/p>""
string(47) ""<p>example with a NBSP here: for testing<\/p>""
😭 1
δοκιμασες άλλο drupal και άλλη php?
e
τρέξε λίγο αυτό:
Copy code
php -r 'echo "LC_CTYPE: ", setlocale(LC_CTYPE,0), PHP_EOL;
        echo "LANG: ", getenv("LANG")?: "(unset)", PHP_EOL;
        echo "LC_ALL: ", getenv("LC_ALL")?: "(unset)", PHP_EOL;
        echo "LC_CTYPE env: ", getenv("LC_CTYPE")?: "(unset)", PHP_EOL;'
m
Copy code
LC_CTYPE: C
LANG: el_GR.UTF-8
LC_ALL: (unset)
LC_CTYPE env: (unset)
e
Σύμφωνα με το ChatGPT εκεί είναι το πρόβλημά μου
Copy code
LC_CTYPE: C.UTF-8
m
ok...
e
Ευχαριστώ για τη βοήθεια
👍 1