Re: Hi everybody
| From: | Johannes Schlüter | Date: | Fri, 10 Apr 2015 00:18:36 +0000 |
| Subject: | Re: Hi everybody | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-12786@lists.php.net to get a copy of this message | ||
Bonjour,
On Thu, 2015-04-09 at 18:50 +0200, Vianney Briois wrote:
> I was motivate to do my own extension because i'm working with php 5.3,
> migrate to 5.4 or more is far beyond the scope right now, and i needed a
> powerful way to clean strings which might contain japanese, chinese, or
> other exotic characters. As you know, Transliteror in php is only available
> for php >= 5.4.
That class should be available via the ICU pecl package in older
versions, too. Also 5.3 is out of support and you should update your
system to benefit from (security) fixes and better performance. There is
hardly any BC (see migration guide)
There is also https://pecl.php.net/package/translit
If that all isn'T possible a few comments:
> So, you can review the source code here :
>
> - https://github.com/vianneyb/pecl_unidecode
1. You should add license headers to the codeto make the license choice
explicit
2. data/mapping.c should be called .h as t is not supposed to be
compiled itself. Did you write the file or is that from Python?
(License?)
3. We're using C89/C90 which requires variable declarations on top of
the block, see
https://wiki.php.net/internals/review_comments#don_t_use_c99_for_portability_reasons
4. If the conversion by utf8_to_utf32() returns an error
(unidecode.c:160) it should emmit an error.
5. there are useless declarations in the php_unidecode.h header, see
https://wiki.php.net/internals/review_comments#php_extnameh_should_be_minimal
I haven't checked the logic or whether offsets etc. are correct, but
otherwise looks ok.
johannes