Doc #74528 [NEW]: mb_check_encoding Documentation Confusing
| From: | james dot antrim at nm dot thm dot de | Date: | Tue, 02 May 2017 10:08:27 +0000 |
| Subject: | Doc #74528 [NEW]: mb_check_encoding Documentation Confusing | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-14665@lists.php.net to get a copy of this message | ||
From: james dot antrim at nm dot thm dot de
Operating system: Debian 3.16.39-1+deb8u2 (2017-03
PHP version: 5.6.30
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:mb_check_encoding Documentation Confusing
Description:
------------
---
From manual page: http://www.php.net/function.mb-detect-encoding
---
I saved a file that was originally ISO-8859-1 to several different
coding standards, among them UTF-8 and Japanese Shift JIS. When using
this function with 'UTF-8' as the 'encoding list' parameter I always get
'UTF-8' as the return value.
I assume this is working as intended, because it really solves both the
problem of detection and conversion in one function. I find the return
documentation more than confusing, because, despite the function being
called 'detect' it does not tell me the original string's encoding, but
the encoding of the converted string if conversion was possible. My
suggestion would be:
"The character encoding or FALSE if the encoding cannot be converted to
any of the given strings."
Test script:
---------------
Convert any ISO-8859-1 file to any other encoding, then run
mb_detect_encoding($file, 'UTF-8', true) on it.
This same documentation problem is evident for mb_check_encoding($file,
'UTF-8') which will always return true under the same conditions.
--
Edit bug report at https://bugs.php.net/bug.php?id=74528&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74528&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74528&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74528&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74528&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74528&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74528&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74528&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74528&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74528&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74528&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74528&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74528&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74528&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74528&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74528&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74528&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74528&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74528&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74528&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74528&r=mysqlcfg