efpapado
08/29/2025, 10:20 AMmsti
08/29/2025, 10:27 AMefpapado
08/29/2025, 10:27 AM$html_string = "<p>example with a NBSP here: 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 είναι falseefpapado
08/29/2025, 10:29 AMdrush php:eval "print_r(parse_url('internal:/landsdeler/Østlandet'))"
και πες μου αν στο path θα δεις encoding problem στο Østlandet (π.χ. εγώ παίρνω
/landsdeler/�_stlandet
)msti
08/29/2025, 10:30 AM$decoded = \Drupal\Component\Utility\Html::decodeEntities($html_string); ετσι;efpapado
08/29/2025, 10:31 AMmsti
08/29/2025, 10:32 AMcat x.php
<?php
$html_string = "<p>example with a NBSP here: 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>""msti
08/29/2025, 10:33 AMmsti
08/29/2025, 10:33 AMstring(54) ""<p>example with a NBSP here: \u00a0 for testing<\/p>""
string(47) ""<p>example with a NBSP here: for testing<\/p>""efpapado
08/29/2025, 10:33 AMmsti
08/29/2025, 10:34 AMefpapado
08/29/2025, 10:34 AMmsti
08/29/2025, 10:35 AM➜ ProductPitDrupal git:(frontend_imrpovements) ✗ ./vendor/bin/drush php:eval "print_r(parse_url('internal:/landsdeler/Østlandet'))"
Array
(
[scheme] => internal
[path] => /landsdeler/Østlandet
)msti
08/29/2025, 10:35 AMmsti
08/29/2025, 10:37 AM➜ 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>""msti
08/29/2025, 10:38 AMefpapado
08/29/2025, 10:38 AMphp -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;'msti
08/29/2025, 10:38 AMLC_CTYPE: C
LANG: el_GR.UTF-8
LC_ALL: (unset)
LC_CTYPE env: (unset)efpapado
08/29/2025, 10:39 AMLC_CTYPE: C.UTF-8msti
08/29/2025, 10:41 AMefpapado
08/29/2025, 10:41 AM