php - Encode any character to numbers/Latin and decode it back -


I have a UTF 8 string that contains non-English symbols.

I tried htmlentities ('a ??')

The result is & amp; Aring; & Amp; Shy; , but I need something like x3445 , so I can use html_entity_decode () or return some basic characters like this.

How can I do this with PHP?

Unfortunately, the heelentity will encode only those characters who have a named institution. To convert everything into a numerical unit, you can use mb_encode_numericentities For example,

  $ string = mb_encode_numericentity (HTML Straits, ENT_QUOTES, 'UTF -8 '), array (0x80, 0xffff, 0, 0xffff),' UTF-8 ');    

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -