[support] Substr or Drupal_substr?

richard at damon-family.org richard at damon-family.org
Tue May 8 15:17:01 UTC 2012


 The problem is that substr does not fully support strings with an utf8
encoding (it counts the multiple bytes as different characters and can thus
chop characters in two). PHP does have (in many versions) multi-byte
character functions to handle these sort of strings, but they are not
enabled by default (and I am not sure if they were generally available when
Drupal first started to use utf8). I guess the implementers of Drupal felt
is was easier to implement their own version of the functions to be m utf8
aware than to deal with the support issues of telling people how to get
these functions enabled on their system. Remember that many people are on
shared hosting systems where adding modules into PHP is not trivial, and
sometimes requires negotiating with the hosting provider to get them to
install it.



On May 8, 2012 at 10:33 AM George Dawson <george.dawson at earthlink.net>
wrote:

> Why does Drupal have it's own substr function? I have noticed on my
system, Drupal is too slow, and this would only add to the overhead of
processing a very simple command. Is Drupal becoming a language in it's own
right?
>
> -----Original Message-----
> >From: Earnie Boyd <earnie at users.sourceforge.net>
> >Sent: May 8, 2012 8:25 AM
> >To: support at drupal.org, "Ms. Nancy Wichmann" <nan_wich at bellsouth.net>
> >Subject: Re: [support] Substr or Drupal_substr?
> >
> >On Mon, May 7, 2012 at 9:11 PM, Ms. Nancy Wichmann
> ><nan_wich at bellsouth.net> wrote:
> >> Coder keeps flagging this, so I thought I'd ask about it. Following a
> >> parse_url() of a URL input from a form, is the use of drupal_substr()
really
> >> necessary, or is a basic substr() adequate?
> >
> >What is the coder message?  I see nothing about drupal_substr in the
> >http://drupal.org/update/modules/6/7 page.  Coder is very imperfect so
> >maybe it is a bug.  I opened several issues last month.
> >
> >--
> >Earnie
> >-- https://sites.google.com/site/earnieboyd
> >--
> >[ Drupal support list | http://lists.drupal.org/ ]
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]


More information about the support mailing list