-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Request #72831: Add encoding option for chr and ord #2083
Conversation
PHPAPI zend_string *php_escape_html_entities(unsigned char *old, size_t oldlen, int all, int flags, char *hint_charset); | ||
PHPAPI zend_string *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, int all, int flags, char *hint_charset, zend_bool double_encode); | ||
PHPAPI zend_string *php_unescape_html_entities(unsigned char *old, size_t oldlen, int all, int flags, char *hint_charset); | ||
PHPAPI unsigned int php_next_utf8_char(const unsigned char *str, size_t str_len, size_t *cursor, int *status); | ||
PHPAPI unsigned int get_next_char(enum entity_charset charset, const unsigned char *str, size_t str_len, size_t *cursor, int *status); | ||
PHPAPI enum entity_charset determine_charset(char *charset_hint); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that if these were to be exported, they should at least have the php_ prefix, like the other functions exposed
c = 0xfffd; | ||
} | ||
|
||
if (c < 0x80) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this reimplement UTF-8 encoding? We already have enough implementations of this scattered around the php-src codebase (one of which is my fault, I must admit).
Also, did you copy this code from somewhere? If so, why couldn't it be reused without copying?
I was going to question whether |
If utf-8 is your target encoding, consider IntlChar::chr() and IntlChar::ord() which have been available in PHP since 7.0 |
This PR has been tagged with the RFC label, so it would be nice to start the RFC process, or to close this PR. |
Gonna close this due to inactivity, please start the RFC process for this if you wish to pick this one up again |
This PR suggests encoding option for
chr
andord
based on #2081.