From a9d87ecf722745e5322b6faea6d57a3f87996b17 Mon Sep 17 00:00:00 2001
From: Mark van der Velden <mark@dynom.nl>
Date: Sat, 18 May 2013 23:54:46 +0200
Subject: [PATCH] Added some multi-byte related fixes.

---
 src/Faker/Generator.php               |  2 +-
 src/Faker/Provider/Base.php           |  6 +++---
 src/Faker/Provider/Internet.php       | 10 +++++-----
 src/Faker/Provider/bg_BG/Internet.php |  2 +-
 src/Faker/Provider/da_DK/Internet.php |  2 +-
 src/Faker/Provider/de_DE/Internet.php |  2 +-
 src/Faker/Provider/en_CA/Address.php  |  4 ++--
 src/Faker/Provider/fr_FR/Internet.php |  2 +-
 src/Faker/Provider/is_IS/Internet.php |  2 +-
 src/Faker/Provider/nl_BE/Internet.php |  2 +-
 src/Faker/Provider/ru_RU/Internet.php |  2 +-
 11 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/Faker/Generator.php b/src/Faker/Generator.php
index 1097683f..3401089d 100644
--- a/src/Faker/Generator.php
+++ b/src/Faker/Generator.php
@@ -53,7 +53,7 @@ class Generator
      */
     public function parse($string)
     {
-        return preg_replace_callback('/\{\{\s?(\w+)\s?\}\}/', array($this, 'callFormatWithMatches'), $string);
+        return preg_replace_callback('/\{\{\s?(\w+)\s?\}\}/u', array($this, 'callFormatWithMatches'), $string);
     }
 
     protected function callFormatWithMatches($matches)
diff --git a/src/Faker/Provider/Base.php b/src/Faker/Provider/Base.php
index 16b74993..a8fd712b 100644
--- a/src/Faker/Provider/Base.php
+++ b/src/Faker/Provider/Base.php
@@ -136,8 +136,8 @@ class Base
      */
     public static function numerify($string = '###')
     {
-        $string = preg_replace_callback('/\#/', 'static::randomDigit', $string);
-        $string = preg_replace_callback('/\%/', 'static::randomDigitNotNull', $string);
+        $string = preg_replace_callback('/\#/u', 'static::randomDigit', $string);
+        $string = preg_replace_callback('/\%/u', 'static::randomDigitNotNull', $string);
 
         return $string;
     }
@@ -150,7 +150,7 @@ class Base
      */
     public static function lexify($string = '????')
     {
-        return preg_replace_callback('/\?/', 'static::randomLetter', $string);
+        return preg_replace_callback('/\?/u', 'static::randomLetter', $string);
     }
 
     /**
diff --git a/src/Faker/Provider/Internet.php b/src/Faker/Provider/Internet.php
index 227a24ca..0ba80f90 100644
--- a/src/Faker/Provider/Internet.php
+++ b/src/Faker/Provider/Internet.php
@@ -29,7 +29,7 @@ class Internet extends \Faker\Provider\Base
     {
         $format = static::randomElement(static::$emailFormats);
 
-        return preg_replace('/\s/', '', $this->generator->parse($format));
+        return preg_replace('/\s/u', '', $this->generator->parse($format));
     }
 
     /**
@@ -37,7 +37,7 @@ class Internet extends \Faker\Provider\Base
      */
     public final function safeEmail()
     {
-        return preg_replace('/\s/', '', $this->userName() . '@' . static::safeEmailDomain());
+        return preg_replace('/\s/u', '', $this->userName() . '@' . static::safeEmailDomain());
     }
 
     /**
@@ -45,7 +45,7 @@ class Internet extends \Faker\Provider\Base
      */
     public function freeEmail()
     {
-        return preg_replace('/\s/', '', $this->userName() . '@' . static::freeEmailDomain());
+        return preg_replace('/\s/u', '', $this->userName() . '@' . static::freeEmailDomain());
     }
 
     /**
@@ -53,7 +53,7 @@ class Internet extends \Faker\Provider\Base
      */
     public function companyEmail()
     {
-        return preg_replace('/\s/', '', $this->userName() . '@' . $this->domainName());
+        return preg_replace('/\s/u', '', $this->userName() . '@' . $this->domainName());
     }
 
     /**
@@ -103,7 +103,7 @@ class Internet extends \Faker\Provider\Base
         $company = $this->generator->format('company');
         $companyElements = explode(' ', $company);
         $company = $companyElements[0];
-        $company = preg_replace('/\W/', '', $company);
+        $company = preg_replace('/\W/u', '', $company);
 
         return static::toLower($company);
     }
diff --git a/src/Faker/Provider/bg_BG/Internet.php b/src/Faker/Provider/bg_BG/Internet.php
index 4c43a31f..04f8fba3 100644
--- a/src/Faker/Provider/bg_BG/Internet.php
+++ b/src/Faker/Provider/bg_BG/Internet.php
@@ -25,7 +25,7 @@ class Internet extends \Faker\Provider\Internet
         $company = $this->generator->format('company');
         $companyElements = explode(' ', $company);
         $company = $companyElements[0];
-        $company = preg_replace('/\W/', '', $company);
+        $company = preg_replace('/\W/u', '', $company);
 
         return $company;
     }
diff --git a/src/Faker/Provider/da_DK/Internet.php b/src/Faker/Provider/da_DK/Internet.php
index 093320eb..2d1e9307 100644
--- a/src/Faker/Provider/da_DK/Internet.php
+++ b/src/Faker/Provider/da_DK/Internet.php
@@ -61,7 +61,7 @@ class Internet extends \Faker\Provider\Internet
         $company = $this->generator->format('company');
         $companyElements = explode(' ', $company);
         $company = $companyElements[0];
-        $company = preg_replace('/\W/', '', $company);
+        $company = preg_replace('/\W/u', '', $company);
 
         return static::toLower(static::toAscii($company));
     }
diff --git a/src/Faker/Provider/de_DE/Internet.php b/src/Faker/Provider/de_DE/Internet.php
index dec56605..52c420af 100644
--- a/src/Faker/Provider/de_DE/Internet.php
+++ b/src/Faker/Provider/de_DE/Internet.php
@@ -38,7 +38,7 @@ class Internet extends \Faker\Provider\Internet
         $company = $this->generator->format('company');
         $companyElements = explode(' ', $company);
         $company = $companyElements[0];
-        $company = preg_replace('/\W/', '', $company);
+        $company = preg_replace('/\W/u', '', $company);
 
         return static::toLower(static::toAscii($company));
     }
diff --git a/src/Faker/Provider/en_CA/Address.php b/src/Faker/Provider/en_CA/Address.php
index 97816441..3dbb8487 100644
--- a/src/Faker/Provider/en_CA/Address.php
+++ b/src/Faker/Provider/en_CA/Address.php
@@ -58,8 +58,8 @@ class Address extends \Faker\Provider\en_US\Address
     {
         $string = static::randomElement(static::$postcode);
 
-        $string = preg_replace_callback('/\#/', 'static::randomDigit', $string);
-        $string = preg_replace_callback('/\?/', 'static::randomPostcodeLetter', $string);
+        $string = preg_replace_callback('/\#/u', 'static::randomDigit', $string);
+        $string = preg_replace_callback('/\?/u', 'static::randomPostcodeLetter', $string);
 
         return static::toUpper($string);
     }
diff --git a/src/Faker/Provider/fr_FR/Internet.php b/src/Faker/Provider/fr_FR/Internet.php
index bc661f32..3f483d27 100644
--- a/src/Faker/Provider/fr_FR/Internet.php
+++ b/src/Faker/Provider/fr_FR/Internet.php
@@ -38,7 +38,7 @@ class Internet extends \Faker\Provider\Internet
         $company = $this->generator->format('company');
         $companyElements = explode(' ', $company);
         $company = $companyElements[0];
-        $company = preg_replace('/\W/', '', $company);
+        $company = preg_replace('/\W/u', '', $company);
 
         return static::toLower(static::toAscii($company));
     }
diff --git a/src/Faker/Provider/is_IS/Internet.php b/src/Faker/Provider/is_IS/Internet.php
index cc8be915..14715aa8 100644
--- a/src/Faker/Provider/is_IS/Internet.php
+++ b/src/Faker/Provider/is_IS/Internet.php
@@ -54,7 +54,7 @@ class Internet extends \Faker\Provider\Internet
         $company = $this->generator->format('company');
         $companyElements = explode(' ', $company);
         $company = $companyElements[0];
-        $company = preg_replace('/\W/', '', $company);
+        $company = preg_replace('/\W/u', '', $company);
 
         return static::toLower(static::toAscii($company));
     }
diff --git a/src/Faker/Provider/nl_BE/Internet.php b/src/Faker/Provider/nl_BE/Internet.php
index af12dbcb..aa9119d6 100644
--- a/src/Faker/Provider/nl_BE/Internet.php
+++ b/src/Faker/Provider/nl_BE/Internet.php
@@ -38,7 +38,7 @@ class Internet extends \Faker\Provider\Internet
         $company = $this->generator->format('company');
         $companyElements = explode(' ', $company);
         $company = $companyElements[0];
-        $company = preg_replace('/\W/', '', $company);
+        $company = preg_replace('/\W/u', '', $company);
 
         return static::toLower(static::toAscii($company));
     }
diff --git a/src/Faker/Provider/ru_RU/Internet.php b/src/Faker/Provider/ru_RU/Internet.php
index 35320f9d..56d72d65 100644
--- a/src/Faker/Provider/ru_RU/Internet.php
+++ b/src/Faker/Provider/ru_RU/Internet.php
@@ -24,7 +24,7 @@ class Internet extends \Faker\Provider\Internet
         $company = $this->generator->format('company');
         $companyElements = explode(' ', $company);
         $company = $companyElements[0];
-        $company = preg_replace('/,/', '', $company);
+        $company = preg_replace('/,/u', '', $company);
 
         return $company;
     }