Every time I try and install on my Arch Linux machine I get dozens of these errors:

Warning: preg_match(): Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 2112 in truncate_utf8() (line 339 of /home/sites/drupal7/includes/unicode.inc).

The Installation seems to complete, and the site seems to be functional, but is there something I can do to fix the warnings?


hermes14’s picture

I also get this cryptic warning on Arch Linux, but not on all the sites I run. This leads me to think that's something related to the themes, rather than the httpd/php configuration. The db collation is also the same. The content type of one of the failing site is
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Does it happen to somebody else? Any clue or hint to get it fixed?

akael’s picture

I only get it on my local machine. I have a server at Linode that is also Arch and I don't get the errors there.

I do use Nginx, PHP-FPM and MySQL on both machines if that means anything.

hermes14’s picture

I use Apache and MySQL.

webengr’s picture

.............. note, recent update on the freebsd server, so likely it was caused by drupal core clashing with the current ports update on freebsd 8.2 stable, using drupal 7, hopefully a mentioned critical fix will address this late March 2012.......... btw, went to drupal 7 dev and it seems to go away... so they hopefully have it patched.

interesting... trying a test site with adaptive theme, corolla, footheme - and then when I use the superfish module and look at configure for a block I see something like it.... strange.

Warning: preg_match() [function.preg-match]: Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 2112 in truncate_utf8() (line 339 of /var/www/htdocs/drupal7/includes/unicode.inc).
Warning: preg_match() [function.preg-match]: Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 2112 in truncate_utf8() (line 339 of /var/www/htdocs/drupal7/includes/unicode.inc).

jsantos65’s picture

Thanks all, this worked like a charm:

Line 77 of /sites/includes/unicode.inc, changed:

'\x{F8FF}\x{FB29}\x{FD3E}-\x{FD3F}\x{FDFC}-\x{FDFD}' .


'\x{D800}-\x{F8FF}\x{FB29}\x{FD3E}-\x{FD3F}\x{FDFC}-\x{FDFD}' .

beto_beto’s picture

i did not find this line at all to replace it

i am using D6.25 !

can you please help
this error appear to me

warning: preg_replace(): Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 1816 in C:\inetpub\vhosts\xxx.com\httpdocs\modules\search\search.module on line 333

beto_beto’s picture

i solved the problem with this solution :

Go to the folder modules / search, open the file search.module.
In line 46 we erase "\ x {D800} - \ x {F8FF} \"

and it will work :)

khurram_mhd’s picture

You really save my life..I spent two days on this.

falz’s picture

I started getting this error yesterday as well. It was after upgrading Apache from 2.2.21->2.2.22. A dependency of this upgrade was PCRE libraries from 8.2.x to 8.3.x. After this upgrade I get:

warning: preg_match() [function.preg-match]: Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 1811 in /usr/local/www/drupal-6.24/sites/all/modules/ctools/includes/cleanstring.inc on line 157.

My system is FreeBSD, I'm still looking for a fix. Could those of you having this issue check your pcre library versions? It seems like a possibility that 8.3 broke compatibility as it did install libpcre.so.1 replacing libpcre.so.0.

hermes14’s picture

I've recently (last sunday) upgraded pcre to 8.30, so it could be.

equipages’s picture

i hadn't checked /usr/ports/UPDATING
i seemed to fix some problems with ImageMajik on another server by symlinking libpcre.so.0 to libpcre.so.1
maybe it will work in this case too
or if that doesn't work we could just get the old libpcre.so.0 and stick it back in there

AFFECTS: users of devel/pcre
AUTHOR: dougb@FreeBSD.org

Until all dependent ports have been updated you should update pcre in
a manner that will preserve its old shared library. For example:

# portmaster -w devel/pcre
# portupgrade devel/pcre

star26bsd’s picture

I have the same issue. Upgraded to pcre-8.30_1, recompiled PHP 5.3.10 but no luck. All Drupal searches are now no longer functioning. This is FreeBSD 7.4-p3. Apache 2.2.22.

star26bsd’s picture

As a workaround, I've downgraded pcre to 8.21 and manually adjusted the Makefile of apache22 and php5 to link against pcre.0 and NOT pcre.1. Recompile, done, all fixed.

bserem’s picture

I'm setting up a new machine with arch and I run into this problem. My previous arch-box didn't have any of this issues. I hadn't updated it for more than a week so I'm also led to believe that PCRE-8.30 is the problem.

update: I filed a task in archlinux flyspray: https://bugs.archlinux.org/task/28533

http://srm.gr - Drupal Implementor

vnvianna’s picture


I'm trying to install drupal on a FreeBSD and got this preg error.

I got a workaround (don't know if its a patch), changing in the includes/unicode.inc the line with 0xD800 to:


It looks like this line is a filter string for preg, and it's complaining about the 0xD800 part.

This workaround looks also very ugly, but better than the error message.


bserem’s picture

I just got a reply from an Arch dev, I'm pasting it:

At a first glance I'd say this is actually a bug in drupal code. They seem to use invalid characters here. An obvious solution would be to remove them. So in includes/unicode.inc remove "\x{D800}-\x{FFF}" from line 76. You should check back with drupal devs though.

He is also suggesting to fix it from the drupal side. I can't really tell which side is the problematic one, but it seems easier to fix on our side.

update: I created an issue on this matter and proposed a patch. http://drupal.org/node/1446372

http://srm.gr - Drupal Implementor

C.H.Riss’s picture

thanks. i didn' find a x{FFF} in out unicode.inc (D7.10) and removed the x{D800} only; that solved the problem for now.

edg’s picture

I can search users but not content.

I get the error: "preg_replace(): Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 1816 " ... on line 333 of the search module

Anybody’s picture

http://www.DROWL.de || Professionelle Drupal Lösungen aus Ostwestfalen-Lippe (OWL)
http://www.webks.de || webks: websolutions kept simple - Webbasierte Lösungen die einfach überzeugen!
http://www.drupal-theming.com || Individuelle Responsive Themes

Sumit kumar’s picture

I am also facing this problem when i configure project

anyone can give direction to me how i can resolve this problem

gpk’s picture

If you are using the latest versions of Drupal and contrib modules then AFAIK the bug should have been fixed (it has certainly been fixed in Drupal core and ctools). If you still have this error then the error message should indicate which module is causing the problem - post back here with details including the module version, or have a look in the module's issue queue.

Good luck!

son_of_flynn’s picture

I had this problem amongst others while trying to install the "Using Drupal 2nd Edition" source (Drupal 7.12) on Windows 7 using Wamp 2.5.

If anyone else has this problem here's how I solved it:

NOTE: This must be done BEFORE install.

1.) File: /drupal-7/includes/unicode.inc

Changed Line #76 from:

'\x{D800}-\x{F8FF}\x{FB29}\x{FD3E}-\x{FD3F}\x{FDFC}-\x{FDFD}' .


'\x{E800}-\x{F8FF}\x{FB29}\x{FD3E}-\x{FD3F}\x{FDFC}-\x{FDFD}' .

As per the same file from Drupal 7.34, yes, really that simple, one letter changed.

Below is how I solved the next errors I encountered on installation...

NOTE: Below must be done DURING install (the configure site page when the error apears).

2.) File: /drupal-7/includes/menu.inc

Changed line #3155 from:

if (!$existing_item || (array_intersect_assoc($item, $existing_item)) != $existing_item) {


if (!$existing_item || (array_intersect_key($item, $existing_item) != $existing_item)) {

Method change and brackets were in the wrong places.

NOTE: The below must be done AFTER install, after clicking visit your site and getting the error.

3.) File: drupal-7/includes/database/query.inc

Couldn't identify the error so replaced with same file from Drupal 7.34.

Hope this helps another Drupal newbie like me!

dkhill’s picture

I saw the same issue when i was navigating through the Using Drupal 2nd Edition as well. Thanks to your posting, I attempted the first two lines and investigated the 3rd option.
Rather than replacing the whole query.inc file and possibly introducing more issues down the road opened the query.inc file and replace the following lines.

Change Lines 1901-1902 (Replace the __clone()function)

 function __clone() {
        $this->changed = TRUE;
        foreach ($this->conditions as $key => $condition) {
          if ($condition['field'] instanceOf QueryConditionInterface) {
            $this->conditions[$key]['field'] = clone($condition['field']);


      function __clone() {
       $this->changed = TRUE;
       foreach ($this->conditions as $key => $condition) {
        if ($key !== '#conjunction') {
         if ($condition['field'] instanceOf QueryConditionInterface) {
          $this->conditions[$key]['field'] = clone($condition['field']);
         if ($condition['value'] instanceOf SelectQueryInterface) {
          $this->conditions[$key]['value'] = clone($condition['value']);

And that addressed my problem.

Hope this helps demystify the "Using Drupal Code".


caalceno’s picture

Warning: preg_match(): Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 2112 in truncate_utf8() (line 339 of C:\xampp\htdocs\dp712\includes\unicode.inc).