Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

This Codeigniter function doesn't account for all accented characters

This is a list of accented characters I have found here.

ÂÃÄÀÁÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ

I have used the Codeigniter function convert_accented_characters to convert accented characters to ASCII characters. However, it seems to fail for two characters (Þ and þ), see output:

AAAeAAAAECEEEEIIIIDjNOOOOOeOUUUUeYÞssaaaaaeaaeceeeeiiiidjnoooooeouuuueyþy

How can I extend this array to account for these two characters.

Would this change be adequate?

'/п/Þ/þ' => 'p', at line 88? I am not familiar with those characters and what language they are from!

like image 532
Abs Avatar asked Apr 23 '15 15:04

Abs


People also ask

Why is my CodeIgniter controller not working?

This happens when the CodeIgniter does not allow certain characters. The controller function of the CodeIgniter only allows a few characters and leaving a blank for all characters is insane. The errors displayed in the developing stage than the production stage can be easily solved. The CodeIgniter provides an easy error handling mechanism.

Why does CodeIgniter say the Uri you submitted has allowed characters?

CodeIgniter has its own strict policy in which characters are not allowed in URLs. That is the main reason error "The URI you submitted has disallowed characters." displays. CodeIgniter restricts characters in URI string to minimize the chances of malicious attack by passing the data to your application.

How to fix ‘the URL you submitted has disallowed characters’ error in CodeIgniter?

In CodeIgniter 2.1.x version the common error is ‘The URL you submitted has disallowed characters'. The safe way of solving this error is making a few changes in line 156 $config { ‘permitted_uri_chars' } = ‘a-z 0-9~%.:_+;' to :


1 Answers

You should add this code

'/Þ|þ/' => 'th',
'/п/' => 'p',

to the array in file application/config/foreign_chars.php

This array is used to define transliteration

Þ or þ are coming from the Icelandic alphabets. Are replaced with the digraph th in english

п is from Cyrillic alphabet and translate in english as p

like image 93
Alessandro Minoccheri Avatar answered Nov 14 '22 15:11

Alessandro Minoccheri