Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-13-2008, 09:16 PM
|
#1
|
|
Senior Member
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,905
Rep:
|
PHP: Problems comparing data from a DB with data from http request
Hi!
I'm trying to compare data that's coming from a DB with data from one http request.
When I use plain old ascii data, I have no problem comparing both, however, when I try to use the string "Universidad Pedagógica Nacional", I can't tell when there's a match between the two. Just to see what was going on, I tried to compare the rawurlencode of both strings, and then I noticed that both string are not exacly equal. See what both values would be:
1: Universidad%20Pedag%C3%B3gica%20Nacional
2: Universidad%20Pedag%F3gica%20Nacional
See? The first is from the http request, the second came from the DB. Any ideas how I can avoid it?
Thanks in advance.
|
|
|
|
08-13-2008, 09:32 PM
|
#2
|
|
Guru
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.4, Centos 5.9
Posts: 15,260
|
First you need to decide which lang you are going to use internally (English or Spanish), then ensure that any entered data is re-rendered into that lang/alphabet.
Or ensure all data entry uses the same UTF encoding std. Unfortunately, there is more than one UTF encoding avail...
http://en.wikipedia.org/wiki/Compari...code_encodings
|
|
|
|
08-13-2008, 09:56 PM
|
#3
|
|
Senior Member
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,905
Original Poster
Rep:
|
Thanks for your swift replay, man. I just noticed that I won't have a problem with that, cause the data that will be provided in the http request will be like the data in the DB (just changed the parameter to what the rawurlencode function said it was and then the match happened! Cool! Now I don't have problems with accents:
Look at basically any item from this list:
http://www.dondeestara.net/beta/?lang=es&city=2
http://www.dondeestara.net/beta/?lang=es&city=1
http://www.dondeestara.net/beta/?lang=en&city=4
Every one works... except for the ones that have a ' or " in the name (like McDonald's, or D'Candido)
I guess I'll have to take a closer look at it tomorrow (it's already late at night here so I'm heading to bed... anyway, take a look to see what you can think of).
|
|
|
|
08-14-2008, 07:55 PM
|
#4
|
|
Senior Member
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,905
Original Poster
Rep:
|
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:02 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|