Pergunta

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)
Foi útil?

Solução

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

Outras dicas

echo html_entity_decode('Växjö', ENT_QUOTES, 'UTF-8');
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top