简体   繁体   中英

convert german umlaut with a bash one-liner using php

Does anyone know why this just gives me an ? instead of a german ä ?

me$: php -r 'echo html_entity_decode("ä");'

The & for instance works well. The locale settings are:

LANG="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_CTYPE="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_ALL=

I am using bash on a Mac.

Try this:

php -r 'echo html_entity_decode("ä",ENT_COMPAT,"UTF-8");'

See: http://php.net/manual/en/function.html-entity-decode.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM