On 22/08/2016 02:52, Yasuo Ohgaki wrote:
Since these
are XML module functions, the name would be xml_latin1_to_utf8() and
xml_utf8_to_latin1(). Suggestions for names are appreciated.
From a user's point of view, these functions have nothing to do with
XML, so I'm not sure the prefix really makes sense. I had no idea until
a few days ago that they were in the same extension in the source, and I
suspect most users aren't even aware that "built-in" functions like this
are arranged in "extensions" at all.
The naming convention in CODING_STANDARDS [1] doesn't actually make
reference to extensions, only a "parent set", so I don't think "xml_" is
a mandatory or natural prefix according to that rule.
[1] https://github.com/php/php-src/blob/master/CODING_STANDARDS
As far as I can see, these functions exist because the XML parser
infrastructure needed them, and someone thought it might be handy to
expose them to users. Funnily enough, the internal versions actually
take a parameter for the target encoding, but only support US-ASCII and
8859-1: https://github.com/php/php-src/blob/master/ext/xml/xml.c#L283
If anything, they should probably have a "str_" prefix, and maybe even
be moved into the string section of the source, exposed in such a way
that the XML parser can still make use of them.
Regards,
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php