Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mb_ series functions have errors #1143

Open
wujwmail opened this issue May 19, 2024 · 0 comments
Open

mb_ series functions have errors #1143

wujwmail opened this issue May 19, 2024 · 0 comments

Comments

@wujwmail
Copy link

wujwmail commented May 19, 2024

Issues discovered through the experimental project https://github.com/wujwmail/PHPExcel_test:

The mb_ series functions have errors when handling UTF-16LE and UTF-16BE character encodings! For example:

<?php

  $utf8_str="这是一个测试";

  $iconv_utf16=iconv('UTF-8', 'UTF-16LE', $utf8_str);

  echo "iconv_to_UTF-16: ".base64_encode($iconv_utf16).PHP_EOL;

  $mb_utf16 = mb_convert_encoding($utf8_str, 'UTF-16LE','UTF-8');

  echo "mb_xx_to_UTF-16: ".base64_encode($mb_utf16).PHP_EOL;


Native PHP execution results:

      iconv_to_UTF-16: 2Y8vZgBOKk5LbdWL
      mb_xx_to_UTF-16: 2Y8vZgBOKk5LbdWL

Peachpie execution results:

      iconv_to_UTF-16: 2Y8vZgBOKk5LbdWL
      mb_xx_to_UTF-16: 6L+Z5piv5LiA5Liq5rWL6K+V
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant