CodeIgniter Forums
Permitting UTF-8 alphabetical chars - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Permitting UTF-8 alphabetical chars (/showthread.php?tid=11405)



Permitting UTF-8 alphabetical chars - El Forum - 09-07-2008

[eluser]cb951303[/eluser]
well, my site does a database search with the keyword taken from the URI but according to this:
Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';

I can't include chars like 'ç', 'ş', 'ğ', 'ı' or any other non ascii utf-8 chars in the URI.
is there a solution to this?

or am I just not supposed to use URI to pass search keywords ?

thanks very much


Permitting UTF-8 alphabetical chars - El Forum - 09-08-2008

[eluser]Crimp[/eluser]
You can use rawurlencode or base 64 encoding. Obviously, use the decode functions to perform the search.


Permitting UTF-8 alphabetical chars - El Forum - 09-08-2008

[eluser]cb951303[/eluser]
great idea thanks


Permitting UTF-8 alphabetical chars - El Forum - 09-09-2008

[eluser]cb951303[/eluser]
I tried rawurlencode and urlcode but they don't seem to work. The string remains untouched. but it only happens with CI. does CI overrides some core php functions or something?


Permitting UTF-8 alphabetical chars - El Forum - 09-09-2008

[eluser]maesk[/eluser]
You could try

Code:
$this->encrypt->encode($your_query);

Read this article by Derek Allard:
http://www.derekallard.com/blog/post/passing-disallowed-characters-through-the-url-in-code-igniter/

I had the same problem and I tried Derek's approach and also base64 encoding and rawurlencode but it didn't work properly. Some characters like '+' or '-' made problems or when the encrypted string contains a '/' (forward slash) CI thinks the URI segment ends there. I ended up passing the query by POST instead of in the URL. For this I had to adapt the pagination class, but it works well now.


Permitting UTF-8 alphabetical chars - El Forum - 09-09-2008

[eluser]cb951303[/eluser]
[quote author="maesk" date="1220984620"]You could try

Code:
$this->encrypt->encode($your_query);
[/quote]
this won't work since the encoded string still *may* contain disallowed chars.

Quote:Read this article by Derek Allard:
http://www.derekallard.com/blog/post/passing-disallowed-characters-through-the-url-in-code-igniter/

I had the same problem and I tried Derek's approach and also base64 encoding and rawurlencode but it didn't work properly. Some characters like '+' or '-' made problems or when the encrypted string contains a '/' (forward slash) CI thinks the URI segment ends there. I ended up passing the query by POST instead of in the URL. For this I had to adapt the pagination class, but it works well now.

Thanks for the link, I'll look at it. My problem is that I use both GET and POST for my search string. Here is the thing, I have a database. Results are returned in a table. The table has a header section with the field names. When the user clicks the field names, it sorts the current search according to that field name ASC or DESC. Thus for the header links I have to use GET. Does anyone have a better idea?

Here is a screenshot:[Image: http://img159.imageshack.us/img159/3415/50443204tg6.th.jpg]


Permitting UTF-8 alphabetical chars - El Forum - 11-05-2008

[eluser]Azghanvi[/eluser]
Any one found any solution for paginiation with search string in url ?
Please share your findings.

CI team ?? any solution ??


Permitting UTF-8 alphabetical chars - El Forum - 11-05-2008

[eluser]Azghanvi[/eluser]
Any one found solution for pagination with search string?
Please share your findings.

CI Team ... please help!

Thanks