Welcome Guest, Not a member yet? Register   Sign In
problem with "permitted_uri_chars" + "url_title" because of "arabic" + "utf-8"
#1

[eluser]DeaD SouL[/eluser]
Hello,

I tried to add the arabic language to url_title() by editing
Code:
'[^a-z0-9\-\._]'        => '',
and changed it to this
Code:
'[^ء-يa-z0-9\-\._]'        => '',
but it didn't work 100% good, some characters were being replaced with �
like this
Quote:�جرد-تجربة-با�عربية
so i decided to use unicode characters blocks instead of the characters
according to Unicode Block 'Arabic'
Code:
ء = U+0621
ي = U+064a
so i've changed it to this
Code:
'[^[U+0621]-[U+064a]a-z0-9\-\._]'        => '',

and it worked just fine Big Grin

so i tried to do the same to
Code:
$config['permitted_uri_chars']

so i added this
Code:
$config['permitted_uri_chars']  = 'a-z 0-9~%.:_\-'; // DEFAULT
$config['permitted_uri_chars']  .= "[U+0621]-[U+064a]"; // INCLUDE ARABIC

it gave me this error
Quote:A PHP Error was encountered

Severity: Warning

Message: preg_match() [function.preg-match]: Compilation failed: range out of order in character class at offset 20

Filename: libraries/URI.php

Line Number: 189

even if i go with this
Code:
$config['permitted_uri_chars']  = 'a-z 0-9~%.:_\-'; // DEFAULT
$config['permitted_uri_chars']  .= 'ء-ي'; // INCLUDE ARABIC

i get this error
Quote:The URI you submitted has disallowed characters.

any idea or help would be greatly appreciated

thanks
#2

[eluser]InsiteFX[/eluser]
Read the user guide you can create your own language files also there are lots of language file already designed on the wiki search for it.

Enjoy
InsiteFX
#3

[eluser]DeaD SouL[/eluser]
dear InsiteFX,
my problem is not with the language files
they are working great

my problem was with the url_site() function
when i use it to make href links

ex:
Code:
echo anchor('controller/method/' . url_site('some_name') , 'click here' );

but it's been solved

[quote author="DeaD SouL" date="1257045025"]
so i decided to use unicode characters blocks instead of the characters
according to Unicode Block 'Arabic'
Code:
ء = U+0621
ي = U+064a
so i've changed it to this
Code:
'[^[U+0621]-[U+064a]a-z0-9\-\._]'        => '',

and it worked just fine Big Grin[/quote]

my currently problem is with
Code:
$config['permitted_uri_chars']  = 'a-z 0-9~%.:_\-';
info:
Quote:/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify with a regular expression 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.
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/


thanks for the tip

anyone else..
#4

[eluser]DeaD SouL[/eluser]
please guys.. I do need help...!!
#5

[eluser]Unknown[/eluser]
جرب هذا = Try This

Code:
$arabic = 'اأآؤءئبتثجحخدذرزسشـصضطظعغفقكلمنهوية';
$config['permitted_uri_chars'] = $arabic.' a-z 0-9~%.:_\-';

أو = or

http://ellislab.com/forums/viewthread/120959/#602089


Smile = :wow:

Tongue
#6

[eluser]DeaD SouL[/eluser]
thanks man, it worked Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB