How to decode utf8 data into simple string in php
Clash 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
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.
How javascript is related to this?
– Leo Odishvili
Aug 6 at 6:36