summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/config/foreign_chars.php104
-rw-r--r--system/helpers/text_helper.php17
2 files changed, 56 insertions, 65 deletions
diff --git a/application/config/foreign_chars.php b/application/config/foreign_chars.php
index e106ad800..14b0d7373 100644
--- a/application/config/foreign_chars.php
+++ b/application/config/foreign_chars.php
@@ -7,58 +7,58 @@
| conversion used by the Text helper
|
*/
-$foreign_characters = array('223' => "ss", // ß
- '224' => "a",
- '225' => "a",
- '226' => "a",
- '229' => "a",
- '227' => "ae",
- '230' => "ae",
- '228' => "ae",
- '231' => "c",
- '232' => "e", // è
- '233' => "e", // é
- '234' => "e", // ê
- '235' => "e", // ë
- '236' => "i",
- '237' => "i",
- '238' => "i",
- '239' => "i",
- '241' => "n",
- '242' => "o",
- '243' => "o",
- '244' => "o",
- '245' => "o",
- '246' => "oe", // ö
- '249' => "u",
- '250' => "u",
- '251' => "u",
- '252' => "ue", // ü
- '255' => "y",
- '257' => "aa",
- '269' => "ch",
- '275' => "ee",
- '291' => "gj",
- '299' => "ii",
- '311' => "kj",
- '316' => "lj",
- '326' => "nj",
- '353' => "sh",
- '363' => "uu",
- '382' => "zh",
- '256' => "aa",
- '268' => "ch",
- '274' => "ee",
- '290' => "gj",
- '298' => "ii",
- '310' => "kj",
- '315' => "lj",
- '325' => "nj",
- '352' => "sh",
- '362' => "uu",
- '381' => "zh",
- );
-
+$foreign_characters = array(
+ '/ä|æ|ǽ/' => 'ae',
+ '/ö|œ/' => 'oe',
+ '/ü/' => 'ue',
+ '/Ä/' => 'Ae',
+ '/Ü/' => 'Ue',
+ '/Ö/' => 'Oe',
+ '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A',
+ '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a',
+ '/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
+ '/ç|ć|ĉ|ċ|č/' => 'c',
+ '/Ð|Ď|Đ/' => 'D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
+ '/ź|ż|ž/' => 'z',
+ '/Æ|Ǽ/' => 'AE',
+ '/ß/'=> 'ss',
+ '/IJ/' => 'IJ',
+ '/ij/' => 'ij',
+ '/Œ/' => 'OE',
+ '/ƒ/' => 'f'
+);
/* End of file foreign_chars.php */
/* Location: ./application/config/foreign_chars.php */ \ No newline at end of file
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index 58b08aaf8..9194b577d 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -364,30 +364,21 @@ if ( ! function_exists('highlight_phrase'))
*/
if ( ! function_exists('convert_accented_characters'))
{
- function convert_accented_characters($match)
+ function convert_accented_characters($str)
{
if ( ! file_exists(APPPATH.'config/foreign_chars'.EXT))
{
- return $match;
+ return $str;
}
include APPPATH.'config/foreign_chars'.EXT;
if ( ! isset($foreign_characters))
{
- return $match;
+ return $str;
}
- $ord = ord($match['1']);
-
- if (isset($foreign_characters[$ord]))
- {
- return $foreign_characters[$ord];
- }
- else
- {
- return $match['1'];
- }
+ return preg_replace(array_keys($foreign_characters), array_values($foreign_characters), $str);
}
}