I have a string as “€“.
I want to convert it to hex to get the value as "\u20AC" so that I can send it to flash.
Same for all currency symbol..
£ -> \u00A3
$ -> \u0024
etc
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First, note that
$is not a known entity in HTML 4.01. It is, however, in HTML 5, and, in PHP 5.4, you can callhtml_entity_decodewithENT_QUOTES | ENT_HTML5to decode it.You have to decode the entity and only then convert it:
If you want to replace only the entities, you can use
preg_replace_callbackto match the entities and then usefooas a callback.gives: