[RFC] Rely on Intl and mbstring, use patchwork/utf8 as fallback

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
Post Reply
Okin7
Registered User
Posts: 7
Joined: Thu Oct 09, 2003 10:57 am
Location: Paris, France
Contact:

[RFC] Rely on Intl and mbstring, use patchwork/utf8 as fallback

Post by Okin7 » Thu Nov 21, 2013 2:36 pm

Hi phpBB team,

I opened a pull request on github at https://github.com/phpbb/phpbb/pull/1880

This pull request is an open invitation to use patchwork/utf8 as phpBB's fallback UTF-8 handling implementation.

See https://github.com/nicolas-grekas/Patchwork-UTF8

As a quick introduction, patchwork/utf8 is both a portability layer for mbstring, iconv, and intl Normalizer and grapheme_* functions, and an UTF-8 grapheme clusters aware replica of native string functions.

It is included in Laravel4 and ownCloud, and as such, it tops more than 400k installs on packagist and a dedicated package in debian. It is well unit tested.

By using directly intl's Normalizer and mbstring in phpBB, and delegating portability to patchwork/utf8, you could gain a lot of code cleanups and simplification. The patch attached shows what is already and quickly possible. That would mean less code to maintain on your side, and more collaboration between projects, as fixes for Laravel4/ownCloud/phpBB/etc. would benefit the community as a whole.

I'm an old user of phpBB and learned a lot of PHP reading your code. patchwork/utf8 also takes some inspiration in what you did. I would be very happy to contribute back, and that's why I'm doing this also.

If you consider this request, I believe that more features of patchwork/utf8 could be used in phpBB, and reciprocally that some problems you address in phpBB could migrate to patchwork/utf8 (e.g. confusable handling).

Waiting for your opinion on that,
With best regards,
Nicolas

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: [RFC] Rely on Intl and mbstring, use patchwork/utf8 as fallback

Post by EXreaction » Sat Jan 18, 2014 3:04 am

Would really be fantastic to use this rather than our own mess of code to maintain.

Does anything behave differently before the patch than it does with this patch applied?

Okin7
Registered User
Posts: 7
Joined: Thu Oct 09, 2003 10:57 am
Location: Paris, France
Contact:

Re: [RFC] Rely on Intl and mbstring, use patchwork/utf8 as fallback

Post by Okin7 » Sat Jan 18, 2014 8:55 am

Thank you for your reply.
I tried to make the current patch as conservative as possible. So, I don't expect any change in behavior.
if you accept the pull request, more cleanups could be done later, but this one was an easy and safe patch

sajaki
Registered User
Posts: 86
Joined: Mon Jun 21, 2010 8:28 pm

Re: [RFC] Rely on Intl and mbstring, use patchwork/utf8 as fallback

Post by sajaki » Mon Jan 27, 2014 1:33 pm

Intl is already a requirement for Symfony2 so integrating this in phpbb3.1 should be a logical step. however, intl and ICU is frequently not a part of the php stack so you have to add it yourself, which is not evident. i had to patch my mamp install to add those extensions.

Post Reply