Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7161955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:39:18+00:00 2026-05-28T13:39:18+00:00

I have a chinese character set as a variable with character encoding as utf-8:

  • 0

I have a chinese character set as a variable with character encoding as utf-8:

$a='列';

From this, how can I get the value ‘5217’ assigned to a string ($b) (possibly using UTF-16? but there might be a better way to do it)?

Codes:
http://www.fileformat.info/info/unicode/char/5217/index.htm

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:39:19+00:00Added an answer on May 28, 2026 at 1:39 pm
    function unicode_decode($str) {
        return preg_replace_callback("/((?:[^\x09\x0A\x0D\x20-\x7E]{3})+)/", "decode_callback", $str);
    }
    
    function decode_callback($matches) {
        $char = mb_convert_encoding($matches[1], "UTF-16", "UTF-8");
        $escaped = "";
        for ($i = 0, $l = strlen($char); $i < $l; $i += 2) {
           $escaped .=  "\u" . sprintf("%02x%02x", ord($char[$i]), ord($char[$i+1]));
        }
        return $escaped;
    }
    
    $a='列';
    var_dump(unicode_decode($a));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySQL table using the UTF-8 character set with a single column
I have read this jsp page encoding problem and this Save Chinese characters with
I have a database full of Asian-character filled records (Chinese, Japanese, and Korean) alongside
Can you create websites with Chinese characters in PHP? UPDATE: Perhaps I should have
I have input data coming from a flat file which has english, japanese, chinese
I have a query string passed in through an HTTP request that has this
I have been editing php files using vim over SSH with PuTTY with encoding=utf-8,
I have a simple string with Chinese characters in my Android application and want
Up to this moment, I still have no luck to resolve this Chinese characters
Let's say I have a random Chinese character, 玩. I want to convert it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.