سؤال

how do i convert below text to something like "Växjö" using PHP?

Växjö

I have tried

html_entity_decode(preg_replace("/U\+([0-9A-F]{4})/", "&#x\\1;", $text), ENT_NOQUOTES, 'UTF-8')
iconv(mb_detect_encoding($text, mb_detect_order(), true), "UTF-8", $text)
هل كانت مفيدة؟

المحلول

Any PHP version from 5.0 onwards should be fine with...

$decoded = html_entity_decode('Växjö', ENT_COMPAT, 'UTF-8');

Demo here - http://3v4l.org/DZc59

نصائح أخرى

echo html_entity_decode('Växjö', ENT_QUOTES, 'UTF-8');
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top