How to decode utf8 data into simple string in php

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How to decode utf8 data into simple string in php



I am facing issue while decoding a utf8 string into simple string which is i am getting from android. String contains both words and emoji's.
For Example:
I am storing this type of data in mysql db u263AuD83DuDE22uD83DuDC4DuD83DuDE0AuD83DuDE0AuD83DuDC90. But fail to decode in readable format.


u263AuD83DuDE22uD83DuDC4DuD83DuDE0AuD83DuDE0AuD83DuDC90





How javascript is related to this?
– Leo Odishvili
Aug 6 at 6:36





If there is any solution using javascript. i can implement.
– Shahrukh
Aug 6 at 6:46




2 Answers
2



If you treat it as JSON object, it will work:


<?php
$input = '"key":"u263AuD83DuDE22uD83DuDC4DuD83DuDE0AuD83DuDE0AuD83DuDC90"';
$output = json_decode($input, true);
print $output["key"];



Output:



☺😢👍😊😊💐





its working. Thanks
– Shahrukh
Aug 6 at 7:01





@Shahrukh Accept the answer plz.
– user4035
Aug 6 at 9:06





How to accept?? I am new to sof.
– Shahrukh
Aug 7 at 10:37





@Shahrukh Click upon the checkmark.
– user4035
Aug 7 at 11:25





i am facing issue while i m decoding multiline message.
– Shahrukh
Aug 14 at 12:38



In javascript you can use decodeURIComponent for that, like this:


function decode(s)
return decodeURIComponent(escape(s));





its not working
– Shahrukh
Aug 7 at 10:37






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS