Welcome Guest, Not a member yet? Register   Sign In
Problem with passing a specific character in another language.
#1

Hi,
I'm trying to pass text from form input in url slug, which is in another language (in greek to be accurate) and even though every character works fine, when i change the y character** which in greek is "υ" i get a webmaster 404_error page. 

**I edited the "application/config/foreign_chars.php" file.

Here's what i post after the form submission:
Code:
 $pet_entry = convert_accented_characters($this->input->post('petTitle_lost'));
 $pet_entry_slug = url_title($pet_entry);


  $data = array(
     etc...etc...etc..
    'pet_entry_slug' = $pet_entry_slug
  )



Any thoughts or suggestions for passing characters other than greek as url slug and replace space, '', / etc to "-" dash?

P.S.: I don't want the characters to be converted in english. 

Thank you in advance.

//Life motto
if (sad() == true) {
     sad().stop();
     develop();
}
Reply
#2

So you want to keep "funny" letters in URL, but replace all other non-letter characters like spaces or slashes with - ?
Reply
#3

How did you edit that file? You need to delete that row in case you want the real character or add a new row if you want it converted.

You also need to edit your application/config/config.php file to support more characters.
PHP Code:
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible.  By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'
Reply
#4

(08-08-2018, 12:38 AM)Pertti Wrote: So you want to keep "funny" letters in URL, but replace all other non-letter characters like spaces or slashes with - ?

Yeap! I tried to delete the character from foreign_chars.php and still i get the webmaster error_404 page! I also inserted the characters in permitted_uri_chars.. still nothing.

Any thoughts?

//Life motto
if (sad() == true) {
     sad().stop();
     develop();
}
Reply
#5

(08-08-2018, 02:12 AM)jreklund Wrote: How did you edit that file? You need to delete that row in case you want the real character or add a new row if you want it converted.

You also need to edit your application/config/config.php file to support more characters.
PHP Code:
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible.  By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'

I inserted the characters i want to change and worked fine, except that single character. i also tried to insert it in accepted_uri_chars and still nothing. I also deleted the character from the file as you said and i get the same error_404 page.

//Life motto
if (sad() == true) {
     sad().stop();
     develop();
}
Reply
#6

If that character is in permitted_uri_chars list, and you enter it on URL, does it end up on right controller/method?

In which case check convert_accented_characters output and what you store in DB. In my opinion going with UTF-8 would be better option, so you store it as provided and don't have to worry about conversions.
Reply
#7

(08-08-2018, 04:54 AM)Pertti Wrote: If that character is in permitted_uri_chars list, and you enter it on URL, does it end up on right controller/method?

In which case check convert_accented_characters output and what you store in DB. In my opinion going with UTF-8 would be better option, so you store it as provided and don't have to worry about conversions.

TBH i think that if i convert it in english char characters it would be better. If i keep it that way the characters in a "CTRL + C" - "CTRL + V" situation eill be shown as "%B0% %C4% etc.. etc..

So i think i will just correct the foreign_chars file for converting to the proper english language characters. 

I think it would have a better usability too!

//Life motto
if (sad() == true) {
     sad().stop();
     develop();
}
Reply




Theme © iAndrew 2016 - Forum software by © MyBB