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 6228751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:26:36+00:00 2026-05-24T09:26:36+00:00

I use iconv php function but some characters doesn’t convert correctly: … $s =

  • 0

I use iconv php function but some characters doesn’t convert correctly:

...
$s = iconv('UTF-16', 'UTF-8', $s);
...
$s = iconv('UTF-16//IGNORE', 'UTF-8', $s);
...
$s = iconv('UTF-16LE', 'UTF-8', $s);
...
$s = iconv('UTF-16LE//IGNORE', 'UTF-8', $s);
...

I also try mb_convert_encoding function but can’t solve my problem.

A sample text file: 9px.ir/utf8-16LE.rar

  • 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-24T09:26:37+00:00Added an answer on May 24, 2026 at 9:26 am

    iconv supports the UTF-16LE encoding.

    You can use it to transpose the encoding from UTF-16LE to UTF-8:

    $result = iconv($in_charset = 'UTF-16LE' , $out_charset = 'UTF-8' , $str);
    if (false === $result)
    {
        throw new Exception('Input string could not be converted.');
    }
    

    See iconvDocs.

    I’m just wondering if all code-points available in UTF-16LE are available in UTF-8. But I assume that this should fit in your case.


    Edit: I was not able to reproduce the problem on a box of my own, but on another box I ran into this notice:

    Notice: iconv() [function.iconv]: Wrong charset, conversion from UTF-16LE' toUTF-8′ is not allowed in …

    Looks like that not all iconv versions can actually convert UTF-16LE to UTF-8.

    It might be a workaround to use mb_convert_encodingDocs instead, at least it was in this case (Demo):

    $result = mb_convert_encoding($str , 'UTF-8' , 'UTF-16LE');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to convert my existing PHP webpage to use UTF-8 encoding. To
My site have a utf-8 encoding (Drupal). I use include function to integrate my
I would like to use standard icons in treeview but I am not sure
In my application I use some icons. Where should I store the path of
I use jQuery to fade in a caption on a icon mouseover. $(#v1).mouseover(function() {
I'm using Codeigniter not for so long but I've some charset problems.. I'm asking
I use this grid to view a table with data: View part: <?php $this->widget('zii.widgets.grid.CGridView',
I use the UploadFile example in EXTJS ( http://dev.sencha.com/deploy/dev/examples/form/file-upload.html ) but I don't know
To begin with, I would normally opt to use a pre-compiled binary of PHP,
Over 1 hour on this. This is javascript code inside my index.php file. function

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.