|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #72831 Add encoding option for chr and ord
Submitted: 2016-08-14 03:52 UTC Modified: 2017-01-09 05:35 UTC
From: masakielastic at gmail dot com Assigned: krakjoe (profile)
Status: Closed Package: Strings related
PHP Version: Next Minor Version OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: masakielastic at gmail dot com
New email:
PHP Version: OS:


 [2016-08-14 03:52 UTC] masakielastic at gmail dot com
This proposal is about adding the encoding option for chr and ord.

string chr ( int $codepoint [, string $encoding = "ISO-8859-1"] )
int ord ( string $string [, string $encoding = "ISO-8859-1"] )

The conversion between character and codepoint can be widely seen in learning Unicode spec, escaping dangerous characters for security, replacing emoji with image for legacy smartphone.

Although intl and mbstring module have the conversion feature (IntlChar::chr, IntlChar::ord, mb_chr, mb_ord), A lot of people are satisfied with UTF-8 and the developers of frameworks want to reduce the dependencies of modules. Symfony developers maintain intl and polyfill-mbstring component.


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-14 04:18 UTC]
-Summary: The encoding option for chr and ord +Summary: Add encoding option for chr and ord
 [2016-08-14 04:18 UTC]
Since this involves character encoding I suggest you mention it on the internals mailing list. Not that I would expect it to require an RFC, but (a) mbstring's age factors into this and (b) such changes could be useful for IntlChar too. There's room for discussion about the issue as a whole, not just the modifications to chr and ord.

One thing to mention now: the default should be according to the default_charset setting ( as is done with a few other functions.
 [2017-01-09 05:35 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2017-01-09 05:35 UTC]
Since this requires an RFC, and there is a PR open on github, closing this issue.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 13 17:01:30 2024 UTC