Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

338
Views
Why is mb_convert_encoding adding a question mark?

Why

$output = '<hello';
echo mb_convert_encoding( $output, 'UTF-16', 'UTF-8' );

displays

<�hello

I was expecting

<hello

Any ideas?

Edit: Seems related to the browser because it works in command line. But I still don't understand...

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

$ echo '<hello' | od -x
0000000      683c    6c65    6f6c    000a                                
0000007
$ php -v
PHP 7.3.11 (cli) (built: Jun  5 2020 23:50:40) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies
$ cat hoge.php 
<?php
$output = '<hello';
echo mb_convert_encoding( $output, 'UTF-16', 'UTF-8' );
$ php hoge.php | od -x
0000000      3c00    6800    6500    6c00    6c00    6f00                
0000014

I tried it. Is that right?

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!