php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #71357 mb_encode_mimeheader(): confusing description of $charset
Submitted: 2016-01-13 12:04 UTC Modified: 2016-01-13 22:34 UTC
From: m dot unarist at gmail dot com Assigned: takagi (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: m dot unarist at gmail dot com
New email:
PHP Version: OS:

 

 [2016-01-13 12:04 UTC] m dot unarist at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.mb-encode-mimeheader
---

> charset specifies the name of the character set in which str is represented in.

I assume "input parameter $str is encoded with $charset" from this sentence, but $charset specifies the character set which is used for the output encoding (i.e. the name will be shown in between "=?" and "?B?" of the MIME header), the input encoding is mb_internal_encoding().

At least, Japanese translation can be read "$charset is the character set name of $str". I think it's wrong.


> mb_internal_encoding() should be set to same encoding.

$str should be represented in same encoding as mb_internal_encoding().

$charset is not related to mb_internal_encoding(), so this sentence should be in the description of $str.

Test script:
---------------
mb_internal_encoding('UTF-8');
mb_language('ja');
$str = "\xe3\x81\x82"; // Japanese string

echo mb_encode_mimeheader($str, 'ISO-2022-JP'); 
// =?ISO-2022-JP?B?GyRCJCIbKEI=?=
echo mb_encode_mimeheader($str, 'UTF-8');
// =?UTF-8?B?44GC?=



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-13 22:28 UTC] takagi@php.net
Automatic comment from SVN on behalf of takagi
Revision: http://svn.php.net/viewvc/?view=revision&revision=338480
Log: Correct misleading parameter description

Close #71357
 [2016-01-13 22:31 UTC] takagi@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: takagi
 [2016-01-13 22:31 UTC] takagi@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2016-01-13 22:34 UTC] takagi@php.net
> At least, Japanese translation can be read "$charset is the character set name of $str". I think it's wrong.

Maybe this is Japanese translation's problem.
I've fixed this.
 http://news.php.net/php.doc.ja/4500
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 08:01:28 2024 UTC